Skip to contentSkip to conversation

spi: topcliff-pch: Properly unregister platform devices on probe() error paths

PATCH Applied Axel Lin 2 participants 2 messages Mar 24, 2014 SPI

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 spi: topcliff-pch: Properly unregister platform devices on probe() error paths

Ensure all registered platform devices are unregistered on probe() error paths.

---
 drivers/spi/spi-topcliff-pch.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-topcliff-pch.c +3 -2
index 3540d52..e935ca6 100644
@@ -1569,8 +1569,7 @@ static struct platform_driver pch_spi_pd_driver = {
 	.resume = pch_spi_pd_resume
 };
 
-static int pch_spi_probe(struct pci_dev *pdev,
-				   const struct pci_device_id *id)
+static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct pch_spi_board_data *board_dat;
 	struct platform_device *pd_dev = NULL;
@@ -1640,6 +1639,8 @@ static int pch_spi_probe(struct pci_dev *pdev,
 	return 0;
 
 err_platform_device:
+	while (--i >= 0)
+		platform_device_unregister(pd_dev_save->pd_save[i]);
 	pci_disable_device(pdev);
 pci_enable_device:
 	pci_release_regions(pdev);
Signature · 8 lines
1.8.3.2



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#1 lore raw
Quoted 1 line · Axel Lin

Ensure all registered platform devices are unregistered on probe() error paths.

Applied, thanks.