Skip to content

Commit

Permalink
mmc: omap_hsmmc: ensure probe returns error upon resource failure
Browse files Browse the repository at this point in the history
If platform_get_resource_by_name() fails, driver probe is aborted an
should return an error so the driver is not bound to the device.

However, in the current error path of platform_get_resource_by_name(),
probe returns zero since the return value (ret) is not properly set.
With a zero return value, the driver core assumes probe was successful
and will bind the driver to the device.

Fix this by ensuring that probe returns an error code in this failure
path.

Signed-off-by: Kevin Hilman <khilman@ti.com>
Acked-by: Venkatraman S <svenkatr@ti.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Kevin Hilman authored and Chris Ball committed Jul 22, 2012
1 parent b6e76f1 commit 9c17d08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/mmc/host/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,13 +1931,15 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
if (!res) {
dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n");
ret = -ENXIO;
goto err_irq;
}
host->dma_line_tx = res->start;

res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
if (!res) {
dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n");
ret = -ENXIO;
goto err_irq;
}
host->dma_line_rx = res->start;
Expand Down

0 comments on commit 9c17d08

Please sign in to comment.