[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240830222332.GA3862110@thelio-3990X>
Date: Fri, 30 Aug 2024 15:23:32 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Mark Brown <broonie@...nel.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Yang Ruibin <11162571@...o.com>, Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
linux-arm-kernel@...ts.infradead.org, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, opensource.kernel@...o.com,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v2] drivers: spi: Insert the missing pci_dev_put()before
return
On Fri, Aug 30, 2024 at 08:57:47PM +0100, Mark Brown wrote:
> On Fri, Aug 30, 2024 at 10:55:06AM +0200, Geert Uytterhoeven wrote:
> > On Thu, Aug 29, 2024 at 5:35 AM Yang Ruibin <11162571@...o.com> wrote:
>
> > > - if (ret)
> > > + if (ret) {
> > > + pci_dev_put(dma_dev);
>
> > dma_dev is still uninitialized at this point.
>
> I'm a bit concerned that this isn't picked up by an allmodconfig with
> the -Werror... I'm currently using GCC 12 for that.
It shows up with -Wmaybe-uninitialized for GCC but that's disabled for
the normal kernel build with commit 78a5255ffb6a ("Stop the ad-hoc games
with -Wno-maybe-initialized"). With GCC 12:
drivers/spi/spi-pxa2xx-pci.c: In function ‘mrfld_spi_setup’:
drivers/spi/spi-pxa2xx-pci.c:228:17: error: ‘dma_dev’ may be used uninitialized [-Werror=maybe-uninitialized]
228 | pci_dev_put(dma_dev);
| ^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-pxa2xx-pci.c:198:25: note: ‘dma_dev’ was declared here
198 | struct pci_dev *dma_dev;
| ^~~~~~~
drivers/spi/spi-pxa2xx-pci.c: In function ‘lpss_spi_setup’:
drivers/spi/spi-pxa2xx-pci.c:150:17: error: ‘dma_dev’ may be used uninitialized [-Werror=maybe-uninitialized]
150 | pci_dev_put(dma_dev);
| ^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-pxa2xx-pci.c:100:25: note: ‘dma_dev’ was declared here
100 | struct pci_dev *dma_dev;
| ^~~~~~~
Clang has it under -Wuninitialized, where it was caught with a regular
allmodconfig build:
drivers/spi/spi-pxa2xx-pci.c:150:15: error: variable 'dma_dev' is uninitialized when used here [-Werror,-Wuninitialized]
150 | pci_dev_put(dma_dev);
| ^~~~~~~
drivers/spi/spi-pxa2xx-pci.c:100:25: note: initialize the variable 'dma_dev' to silence this warning
100 | struct pci_dev *dma_dev;
| ^
| = NULL
drivers/spi/spi-pxa2xx-pci.c:228:15: error: variable 'dma_dev' is uninitialized when used here [-Werror,-Wuninitialized]
228 | pci_dev_put(dma_dev);
| ^~~~~~~
drivers/spi/spi-pxa2xx-pci.c:198:25: note: initialize the variable 'dma_dev' to silence this warning
198 | struct pci_dev *dma_dev;
| ^
| = NULL
Perhaps a KCFLAGS=-Wmaybe-uninitialized in your make command or adding
subdir-ccflags-$(CONFIG_CC_IS_GCC) := -Wmaybe-uninitialized
to the makefiles of the drivers that you maintain might not be a bad
idea.
Cheers,
Nathan
Powered by blists - more mailing lists