Skip to contentSkip to conversation

mmc: Fix EINVAL if an mmc_spi controller has no IRQ

PATCH New Chris Boot 1 participant 1 message May 25, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Chris Boot

author
#0 lore raw

PATCH 1/1 mmc: Fix EINVAL if an mmc_spi controller has no IRQ

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.

---
 drivers/mmc/host/of_mmc_spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/of_mmc_spi.c +1 -1
index 1534b58..d3e882a 100644
@@ -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 {
Signature · 1 line
1.7.10