linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Boot <bootc@bootc.net>
To: linux-mmc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Chris Boot <bootc@bootc.net>
Subject: [PATCH] mmc: Fix EINVAL if an mmc_spi controller has no IRQ
Date: Fri, 25 May 2012 18:00:30 +0100	[thread overview]
Message-ID: <1337965230-4589-1-git-send-email-bootc@bootc.net> (raw)

irq_of_parse_and_map() returns EINVAL if there is no interrupt
information available in device tree, not NO_IRQ. mmc_spi_get_pdata()
doesn't account for error returns, and ends up trying to
request_threaded_irq() with -22 as the IRQ value.

This patch checks for negative returns from irq_of_parse_and_map() as
well as NO_IRQ, and uses polled mode in those cases.

Signed-off-by: Chris Boot <bootc@bootc.net>
---
 drivers/mmc/host/of_mmc_spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 1534b58..d3e882a 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -146,7 +146,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 		oms->pdata.get_ro = of_mmc_spi_get_ro;
 
 	oms->detect_irq = irq_of_parse_and_map(np, 0);
-	if (oms->detect_irq != NO_IRQ) {
+	if (oms->detect_irq != NO_IRQ && oms->detect_irq > 0) {
 		oms->pdata.init = of_mmc_spi_init;
 		oms->pdata.exit = of_mmc_spi_exit;
 	} else {
-- 
1.7.10


                 reply	other threads:[~2012-05-25 17:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1337965230-4589-1-git-send-email-bootc@bootc.net \
    --to=bootc@bootc.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).