public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: cqspi: fix error return code in cqspi_probe()
@ 2017-08-09 16:22 Gustavo A. R. Silva
  2017-08-09 17:16 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-08-09 16:22 UTC (permalink / raw)
  To: Cyrille Pitchen, Marek Vasut, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel, Gustavo A. R. Silva

platform_get_irq() returns an error code, but the cadence-quadspi
driver ignores it and always returns -ENXIO. This is not correct
and, prevents -EPROBE_DEFER from being propagated properly.

Print and propagate the return value of platform_get_irq on failure.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 53c7d8e..15dacf5 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1202,8 +1202,8 @@ static int cqspi_probe(struct platform_device *pdev)
 	/* Obtain IRQ line. */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(dev, "Cannot obtain IRQ.\n");
-		return -ENXIO;
+		dev_err(dev, "Cannot obtain IRQ: %d\n", irq);
+		return irq;
 	}
 
 	ret = clk_prepare_enable(cqspi->clk);
-- 
2.5.0

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

* Re: [PATCH] mtd: spi-nor: cqspi: fix error return code in cqspi_probe()
  2017-08-09 16:22 [PATCH] mtd: spi-nor: cqspi: fix error return code in cqspi_probe() Gustavo A. R. Silva
@ 2017-08-09 17:16 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2017-08-09 17:16 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Cyrille Pitchen, David Woodhouse,
	Brian Norris, Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

On 08/09/2017 06:22 PM, Gustavo A. R. Silva wrote:
> platform_get_irq() returns an error code, but the cadence-quadspi
> driver ignores it and always returns -ENXIO. This is not correct
> and, prevents -EPROBE_DEFER from being propagated properly.
> 
> Print and propagate the return value of platform_get_irq on failure.
> 
> This issue was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index 53c7d8e..15dacf5 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -1202,8 +1202,8 @@ static int cqspi_probe(struct platform_device *pdev)
>  	/* Obtain IRQ line. */
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
> -		dev_err(dev, "Cannot obtain IRQ.\n");
> -		return -ENXIO;
> +		dev_err(dev, "Cannot obtain IRQ: %d\n", irq);

"Cannot obtain IRQ, ret=%i\n" please . It's inobvious what the value
means otherwise.

> +		return irq;
>  	}
>  
>  	ret = clk_prepare_enable(cqspi->clk);
> 


-- 
Best regards,
Marek Vasut

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

end of thread, other threads:[~2017-08-09 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09 16:22 [PATCH] mtd: spi-nor: cqspi: fix error return code in cqspi_probe() Gustavo A. R. Silva
2017-08-09 17:16 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox