From: Kevin Hilman <khilman@ti.com>
To: Chris Ball <cjb@laptop.org>, Venkatraman S <svenkatr@ti.com>,
linux-mmc@vger.kernel.org
Cc: linux-omap@vger.kernel.org,
Balaji T K <balajitk@ti.com> (commit_signer:14/49=29%),
Rajendra Nayak <rnayak@ti.com> (commit_signer:11/49=22%),
Adrian Hunter <adrian.hunter@intel.com> (commit_signer:9/49=18%),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] mmc: omap_hsmmc: ensure probe returns error upon resource failure
Date: Tue, 10 Jul 2012 16:40:56 -0700 [thread overview]
Message-ID: <1341963658-20896-1-git-send-email-khilman@ti.com> (raw)
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>
---
drivers/mmc/host/omap_hsmmc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 389a3ee..19e60e9 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1931,6 +1931,7 @@ 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;
@@ -1938,6 +1939,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
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;
--
1.7.9.2
next reply other threads:[~2012-07-10 23:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 23:40 Kevin Hilman [this message]
2012-07-12 6:19 ` S, Venkatraman
2012-07-21 23:23 ` Chris Ball
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341963658-20896-1-git-send-email-khilman@ti.com \
--to=khilman@ti.com \
--cc=adrian.hunter@intel.com \
--cc=balajitk@ti.com \
--cc=cjb@laptop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rnayak@ti.com \
--cc=svenkatr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®