Skip to content

Commit bf62a8c

Browse files
nathanchancebroonie
authored andcommitted
spi: Revert "spi: Insert the missing pci_dev_put()before return"
Commit 8a0ec8c ("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 609d7ff ("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: 8a0ec8c ("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>
1 parent f626a0c commit bf62a8c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/spi/spi-pxa2xx-pci.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,8 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c)
145145
c->num_chipselect = 1;
146146

147147
ret = pxa2xx_spi_pci_clk_register(dev, ssp, 50000000);
148-
if (ret) {
149-
pci_dev_put(dma_dev);
148+
if (ret)
150149
return ret;
151-
}
152150

153151
dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
154152
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)
223221
}
224222

225223
ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000);
226-
if (ret) {
227-
pci_dev_put(dma_dev);
224+
if (ret)
228225
return ret;
229-
}
230226

231227
dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0));
232228
ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev);

0 commit comments

Comments
 (0)