diff options
author | Nathan Chancellor <nathan@kernel.org> | 2024-09-02 17:43:06 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-09-03 12:37:20 +0100 |
commit | bf62a8c7908ee8e0ef61d27d9ff65bf12f41fb0a (patch) | |
tree | b3bcb434a864eb33de4e6c293583c55af49f9e61 | |
parent | f626a0cd07ddb13f146e52adb4b534da40bb1ff7 (diff) | |
download | lwn-bf62a8c7908ee8e0ef61d27d9ff65bf12f41fb0a.tar.gz lwn-bf62a8c7908ee8e0ef61d27d9ff65bf12f41fb0a.zip |
spi: Revert "spi: Insert the missing pci_dev_put()before return"
Commit 8a0ec8c2d736 ("spi: Insert the missing pci_dev_put()before
return") added two uses of pci_dev_put() with an uninitialized dma_dev,
resulting in the following compiler warnings (or errors with
CONFIG_WERROR) when building with clang:
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:228:15: error: variable 'dma_dev' is uninitialized when used here [-Werror,-Wuninitialized]
228 | pci_dev_put(dma_dev);
| ^~~~~~~
Commit 609d7ffdc421 ("spi: pxa2xx-pci: Balance reference count for PCI
DMA device") added a call to pci_dev_put() via
devm_add_action_or_reset() in case of failures, so the recent change was
incorrect for multiple reasons. Revert it altogether.
Fixes: 8a0ec8c2d736 ("spi: Insert the missing pci_dev_put()before return")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/CAMuHMdWNjo69_W6f+R9QJJOf8uF0htg2XazeS-yjugJv3UM+kg@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20240902-spi-revert-8a0ec8c2d736-v1-1-928b829fed2b@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-pxa2xx-pci.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index d49d8fef4088..616d032f1a89 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -145,10 +145,8 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) c->num_chipselect = 1; ret = pxa2xx_spi_pci_clk_register(dev, ssp, 50000000); - if (ret) { - pci_dev_put(dma_dev); + if (ret) return ret; - } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); @@ -223,10 +221,8 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) } ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000); - if (ret) { - pci_dev_put(dma_dev); + if (ret) return ret; - } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); |