Skip to contentSkip to conversation

mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()

PATCH In review Roland Stigge 2 participants 2 messages Jan 30, 2013 – Feb 11, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()

When irq_of_parse_and_map() returns an error, it does as zero. But in mmc_spi_get_pdata(), the error return case is compared against NO_IRQ. This might work where NO_IRQ is zero (defaults to zero when undefined, as on MIPS) but not where NO_IRQ is sth. different, e.g. on ARM, where it is -1.

This patch changes to comparison with 0 which is the error return value of irq_of_parse_and_map().

Tested on ARM that mmc_spi is working now.

drivers/mmc/host/of_mmc_spi.c +1 -1
index 1534b58..d720b5e 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 != 0) {
 		oms->pdata.init = of_mmc_spi_init;
 		oms->pdata.exit = of_mmc_spi_exit;
 	} else {
#1 lore raw

Hi,

Quoted 17 lines · Roland Stigge

When irq_of_parse_and_map() returns an error, it does as zero. But in mmc_spi_get_pdata(), the error return case is compared against NO_IRQ. This might work where NO_IRQ is zero (defaults to zero when undefined, as on MIPS) but not where NO_IRQ is sth. different, e.g. on ARM, where it is -1.

This patch changes to comparison with 0 which is the error return value of irq_of_parse_and_map().

Tested on ARM that mmc_spi is working now.

drivers/mmc/host/of_mmc_spi.c +0 -0
index 1534b58..d720b5e 100644

drivers/mmc/host/of_mmc_spi.c struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) · line 152

Quoted 8 lines
drivers/mmc/host/of_mmc_spi.c +1 -1
@@ -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 != 0) {
 		oms->pdata.init = of_mmc_spi_init;
 		oms->pdata.exit = of_mmc_spi_exit;
 	} else {

Thanks, pushed to mmc-next for 3.9.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child