linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()
@ 2013-01-30 17:05 Roland Stigge
  2013-02-11 16:49 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Stigge @ 2013-01-30 17:05 UTC (permalink / raw)
  To: cjb, plagnioj, grant.likely, linux-mmc, linux-kernel, linux-arm-kernel
  Cc: 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.

Signed-off-by: Roland Stigge <stigge@antcom.de>

diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 1534b58..d720b5e 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 != 0) {
 		oms->pdata.init = of_mmc_spi_init;
 		oms->pdata.exit = of_mmc_spi_exit;
 	} else {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()
  2013-01-30 17:05 [PATCH] mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map() Roland Stigge
@ 2013-02-11 16:49 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2013-02-11 16:49 UTC (permalink / raw)
  To: Roland Stigge
  Cc: plagnioj, grant.likely, linux-mmc, linux-kernel, linux-arm-kernel

Hi,

On Wed, Jan 30 2013, Roland Stigge wrote:
> 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.
>
> Signed-off-by: Roland Stigge <stigge@antcom.de>
>
> diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
> index 1534b58..d720b5e 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 != 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.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-11 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30 17:05 [PATCH] mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map() Roland Stigge
2013-02-11 16:49 ` Chris Ball

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).