From: Lee Jones <lee.jones@linaro.org>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Paul Mackerras <paulus@samba.org>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused
Date: Thu, 5 Nov 2020 09:00:07 +0000 [thread overview]
Message-ID: <20201105090007.GE4488@dell> (raw)
In-Reply-To: <a6b63789-1315-cec1-9575-0d858a6da1d5@kernel.org>
On Thu, 05 Nov 2020, Jiri Slaby wrote:
> On 05. 11. 20, 9:36, Lee Jones wrote:
> > On Thu, 05 Nov 2020, Jiri Slaby wrote:
> >
> > > On 05. 11. 20, 8:04, Christophe Leroy wrote:
> > > >
> > > >
> > > > Le 04/11/2020 à 20:35, Lee Jones a écrit :
> > > > > Fixes the following W=1 kernel build warning(s):
> > > > >
> > > > > drivers/tty/serial/pmac_zilog.h:365:58: warning: variable
> > > > > ‘garbage’ set but not used [-Wunused-but-set-variable]
> > > >
> > > > Explain how you are fixing this warning.
> > > >
> > > > Setting __always_unused is usually not the good solution for fixing
> > > > this warning, but here I guess this is likely the good solution. But it
> > > > should be explained why.
> >
> > There are normally 3 ways to fix this warning;
> >
> > - Start using/checking the variable/result
> > - Remove the variable
> > - Mark it as __{always,maybe}_unused
> >
> > The later just tells the compiler that not checking the resultant
> > value is intentional. There are some functions (as Jiri mentions
> > below) which are marked as '__must_check' which *require* a dummy
> > (garbage) variable to be used.
> >
> > > Or, why is the "garbage =" needed in the first place? read_zsdata is not
> > > defined with __warn_unused_result__.
> >
> > I used '__always_used' here for fear of breaking something.
> >
> > However, if it's safe to remove it, then all the better.
>
> Yes please -- this "garbage" is one of the examples of volatile misuses. If
> readb didn't work on volatile pointer, marking the return variable as
> volatile wouldn't save it.
>
> > > And even if it was, would (void)!read_zsdata(port) fix it?
> >
> > That's hideous. :D
>
> Sure, marking reads as must_check would be insane.
>
> > *Much* better to just use '__always_used' in that use-case.
>
> Then using a dummy variable to fool must_check must mean must_check is used
> incorrectly, no :)? But there are always exceptions…
Agreed on all points.
Will fix.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused
Date: Thu, 5 Nov 2020 09:00:07 +0000 [thread overview]
Message-ID: <20201105090007.GE4488@dell> (raw)
In-Reply-To: <a6b63789-1315-cec1-9575-0d858a6da1d5@kernel.org>
On Thu, 05 Nov 2020, Jiri Slaby wrote:
> On 05. 11. 20, 9:36, Lee Jones wrote:
> > On Thu, 05 Nov 2020, Jiri Slaby wrote:
> >
> > > On 05. 11. 20, 8:04, Christophe Leroy wrote:
> > > >
> > > >
> > > > Le 04/11/2020 à 20:35, Lee Jones a écrit :
> > > > > Fixes the following W=1 kernel build warning(s):
> > > > >
> > > > > drivers/tty/serial/pmac_zilog.h:365:58: warning: variable
> > > > > ‘garbage’ set but not used [-Wunused-but-set-variable]
> > > >
> > > > Explain how you are fixing this warning.
> > > >
> > > > Setting __always_unused is usually not the good solution for fixing
> > > > this warning, but here I guess this is likely the good solution. But it
> > > > should be explained why.
> >
> > There are normally 3 ways to fix this warning;
> >
> > - Start using/checking the variable/result
> > - Remove the variable
> > - Mark it as __{always,maybe}_unused
> >
> > The later just tells the compiler that not checking the resultant
> > value is intentional. There are some functions (as Jiri mentions
> > below) which are marked as '__must_check' which *require* a dummy
> > (garbage) variable to be used.
> >
> > > Or, why is the "garbage =" needed in the first place? read_zsdata is not
> > > defined with __warn_unused_result__.
> >
> > I used '__always_used' here for fear of breaking something.
> >
> > However, if it's safe to remove it, then all the better.
>
> Yes please -- this "garbage" is one of the examples of volatile misuses. If
> readb didn't work on volatile pointer, marking the return variable as
> volatile wouldn't save it.
>
> > > And even if it was, would (void)!read_zsdata(port) fix it?
> >
> > That's hideous. :D
>
> Sure, marking reads as must_check would be insane.
>
> > *Much* better to just use '__always_used' in that use-case.
>
> Then using a dummy variable to fool must_check must mean must_check is used
> incorrectly, no :)? But there are always exceptions…
Agreed on all points.
Will fix.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2020-11-05 9:00 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 19:35 [PATCH 00/36] Rid W=1 issues from TTY Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` [PATCH 01/36] tty: serdev: core: Remove unused variable 'dummy' Lee Jones
2020-11-04 19:35 ` [PATCH 02/36] tty: serdev: core: Provide missing description for 'owner' Lee Jones
2020-11-04 19:35 ` [PATCH 03/36] tty: tty_baudrate: Add missing description for 'tty' Lee Jones
2020-11-04 19:35 ` [PATCH 04/36] tty: tty_io: Move 'tty_sysctl_init's prototype to shared space Lee Jones
2020-11-04 19:35 ` [PATCH 05/36] tty: tty_buffer: Add missing description for 'limit' Lee Jones
2020-11-04 19:35 ` [PATCH 06/36] tty: tty_port: Demote obvious abuse of kernel-doc formatting Lee Jones
2020-11-04 19:35 ` [PATCH 07/36] tty: tty_jobctrl: Add missing function parameter descriptions Lee Jones
2020-11-04 19:35 ` [PATCH 08/36] tty: tty_ldisc: Fix some kernel-doc related misdemeanours Lee Jones
2020-11-05 8:12 ` Jiri Slaby
2020-11-05 8:54 ` Lee Jones
2020-11-05 8:56 ` Lee Jones
2020-11-04 19:35 ` [PATCH 09/36] tty: vt: consolemap: Demote weakly documented function header Lee Jones
2020-11-04 19:35 ` [PATCH 10/36] tty: n_tty: Add 2 missing parameter descriptions Lee Jones
2020-11-04 19:35 ` [PATCH 11/36] tty: serial: jsm: jsm_cls: Remove unused variable 'discard' Lee Jones
2020-11-04 19:35 ` [PATCH 12/36] tty: tty_io: Fix some kernel-doc issues Lee Jones
2020-11-05 8:16 ` Jiri Slaby
2020-11-05 8:53 ` Lee Jones
2020-11-05 9:14 ` Jiri Slaby
2020-11-04 19:35 ` [PATCH 13/36] tty: serial: 8250: 8250_port: Staticify functions referenced by pointers Lee Jones
2020-11-05 1:30 ` kernel test robot
2020-11-05 1:46 ` kernel test robot
2020-11-06 9:53 ` Greg Kroah-Hartman
2020-11-06 10:05 ` Lee Jones
2020-11-06 10:16 ` Lee Jones
2020-11-06 10:39 ` Greg Kroah-Hartman
2020-11-06 10:48 ` Lee Jones
2020-11-06 10:55 ` Greg Kroah-Hartman
2020-11-06 11:12 ` Lee Jones
2020-11-06 11:19 ` Jiri Slaby
2020-11-06 14:47 ` Lee Jones
2020-11-06 10:20 ` Greg Kroah-Hartman
2020-11-06 10:47 ` Lee Jones
2020-11-04 19:35 ` [PATCH 14/36] tty: serial: 8250: serial_cs: Remove unused/unchecked variable 'err' Lee Jones
2020-11-04 19:35 ` [PATCH 15/36] tty: tty_audit: Demote non-conformant kernel-doc headers Lee Jones
2020-11-04 19:35 ` [PATCH 16/36] tty: pty: Provide descriptions for the 'file' parameters Lee Jones
2020-11-04 19:35 ` [PATCH 17/36] tty: serial: amba-pl011: Mark 'sbsa_uart_acpi_match' as __maybe_unused Lee Jones
2020-11-04 19:35 ` [PATCH 18/36] tty: n_gsm: Demote obvious abuse of kernel-doc and supply other missing docss Lee Jones
2020-11-04 19:35 ` [PATCH 19/36] tty: serial: lpc32xx_hs: Remove unused variable 'tmp' Lee Jones
2020-11-04 20:04 ` Vladimir Zapolskiy
2020-11-04 19:35 ` [PATCH 20/36] tty: serial: msm_serial: Remove set but unused variable 'status' Lee Jones
2020-11-05 16:09 ` Jeffrey Hugo
2020-11-04 19:35 ` [PATCH 21/36] tty: serial: ifx6x60: Fix function documentation headers Lee Jones
2020-11-04 19:35 ` [PATCH 22/36] tty: serial: xilinx_uartps: Supply description for missing member 'cts_override' Lee Jones
2020-11-16 10:55 ` Maarten Brock
2020-11-16 12:38 ` Lee Jones
2020-11-04 19:35 ` [PATCH 23/36] tty: synclink_gt: Demote one kernel-doc header and repair another Lee Jones
2020-11-04 19:35 ` [PATCH 24/36] tty: serial: serial-tegra: Struct headers should start with 'struct <name>' Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` [PATCH 25/36] tty: serial: sifive: " Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-06 8:11 ` Palmer Dabbelt
2020-11-06 8:11 ` Palmer Dabbelt
2020-11-04 19:35 ` [PATCH 26/36] tty: synclinkmp: Add missing description for function param 'txqueue' Lee Jones
2020-11-04 19:35 ` [PATCH 27/36] tty: synclinkmp: Mark never checked 'readval' as __always_unused Lee Jones
2020-11-05 8:28 ` Jiri Slaby
2020-11-05 8:43 ` Lee Jones
2020-11-05 9:10 ` Jiri Slaby
2020-11-05 9:39 ` Paul Fulghum
2020-11-05 9:55 ` Greg Kroah-Hartman
2020-11-05 10:05 ` Lee Jones
2020-11-05 10:54 ` Jiri Slaby
2020-11-05 11:04 ` David Laight
2020-11-05 11:27 ` Lee Jones
[not found] ` <54D08301-C89F-4AEB-B9A0-6CED6D5EEDA6@microgate.com>
2020-11-05 17:04 ` Paul Fulghum
2020-11-05 18:05 ` Lee Jones
2020-11-05 16:41 ` Jiri Slaby
2020-11-04 19:35 ` [PATCH 28/36] tty: serial: stm32-usart: Remove set but unused 'cookie' variables Lee Jones
2020-11-04 19:35 ` [PATCH 29/36] tty: tty_ldisc: Supply missing description for 'tty_ldisc_get's 'tty' param Lee Jones
2020-11-04 19:35 ` [PATCH 30/36] tty: serial: serial-tegra: Provide some missing struct member descriptions Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` [PATCH 31/36] powerpc: asm: hvconsole: Move 'hvc_vio_init_early's prototype to shared location Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 23:36 ` Michael Ellerman
2020-11-04 23:36 ` Michael Ellerman
2020-11-05 8:39 ` Lee Jones
2020-11-05 8:39 ` Lee Jones
2020-11-05 7:10 ` Christophe Leroy
2020-11-05 7:10 ` Christophe Leroy
2020-11-05 8:38 ` Lee Jones
2020-11-05 8:38 ` Lee Jones
2020-11-26 9:36 ` [PATCH v2 " Lee Jones
2020-11-04 19:35 ` [PATCH 32/36] tty: hvc: hvc_vio: Staticify function invoked only by reference Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` [PATCH 33/36] tty: hvc: hvc_opal: Staticify function invoked " Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-04 19:35 ` [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused Lee Jones
2020-11-04 19:35 ` Lee Jones
2020-11-05 7:04 ` Christophe Leroy
2020-11-05 7:39 ` Jiri Slaby
2020-11-05 8:36 ` Lee Jones
2020-11-05 8:36 ` Lee Jones
2020-11-05 8:55 ` Jiri Slaby
2020-11-05 8:55 ` Jiri Slaby
2020-11-05 9:00 ` Lee Jones [this message]
2020-11-05 9:00 ` Lee Jones
2020-11-04 19:35 ` [PATCH 35/36] tty: synclink: Mark disposable variables as __always_unused Lee Jones
2020-11-05 8:35 ` Jiri Slaby
2020-11-05 9:00 ` Lee Jones
2020-11-04 19:35 ` [PATCH 36/36] tty: synclink: Provide missing description for 'hdlcdev_tx_timeout's 'txqueue' param Lee Jones
2020-11-06 9:54 ` [PATCH 00/36] Rid W=1 issues from TTY Greg Kroah-Hartman
2020-11-06 9:54 ` Greg Kroah-Hartman
2020-11-06 9:54 ` Greg Kroah-Hartman
2020-11-06 9:54 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201105090007.GE4488@dell \
--to=lee.jones@linaro.org \
--cc=christophe.leroy@csgroup.eu \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.