aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Glauber <jglauber@cavium.com>2017-05-22 07:09:21 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-05-22 12:01:46 -0400
commit8fb83b142823cdd1f85f78dcf9e861e9033919f9 (patch)
treeb95b866597e850c25967f03c6f6fe687b6f041b9
parentc2372c20425bd75a5527b3e2204059762190f6ca (diff)
mmc: cavium: Fix probing race with regulator
If the regulator probing is not yet finished this driver might catch a -EPROBE_DEFER. Returning after this condition did not remove the created platform device. On a repeated call to the probe function the of_platform_device_create fails. Calling of_platform_device_destroy after EPROBE_DEFER resolves this bug. Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/cavium-octeon.c11
-rw-r--r--drivers/mmc/host/cavium-thunderx.c6
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
index cbb566377508..951d2cdd7888 100644
--- a/drivers/mmc/host/cavium-octeon.c
+++ b/drivers/mmc/host/cavium-octeon.c
@@ -288,11 +288,20 @@ static int octeon_mmc_probe(struct platform_device *pdev)
288 if (ret) { 288 if (ret) {
289 dev_err(&pdev->dev, "Error populating slots\n"); 289 dev_err(&pdev->dev, "Error populating slots\n");
290 octeon_mmc_set_shared_power(host, 0); 290 octeon_mmc_set_shared_power(host, 0);
291 return ret; 291 goto error;
292 } 292 }
293 i++; 293 i++;
294 } 294 }
295 return 0; 295 return 0;
296
297error:
298 for (i = 0; i < CAVIUM_MAX_MMC; i++) {
299 if (host->slot[i])
300 cvm_mmc_of_slot_remove(host->slot[i]);
301 if (host->slot_pdev[i])
302 of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
303 }
304 return ret;
296} 305}
297 306
298static int octeon_mmc_remove(struct platform_device *pdev) 307static int octeon_mmc_remove(struct platform_device *pdev)
diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-thunderx.c
index fe3d77267cd6..b9cc95998799 100644
--- a/drivers/mmc/host/cavium-thunderx.c
+++ b/drivers/mmc/host/cavium-thunderx.c
@@ -146,6 +146,12 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
146 return 0; 146 return 0;
147 147
148error: 148error:
149 for (i = 0; i < CAVIUM_MAX_MMC; i++) {
150 if (host->slot[i])
151 cvm_mmc_of_slot_remove(host->slot[i]);
152 if (host->slot_pdev[i])
153 of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
154 }
149 clk_disable_unprepare(host->clk); 155 clk_disable_unprepare(host->clk);
150 return ret; 156 return ret;
151} 157}