mtd: spi-nor: cqspi: fix error return code in cqspi_probe()
Subsystems (2)
PATCH 1/1 mtd: spi-nor: cqspi: fix error return code in cqspi_probe()
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.
--- drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/cadence-quadspi.c +2 -2
@@ -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);
Signature · 1 line
2.5.0
Quoted 18 lines · 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_irqon failure.This issue was detected with the help of Coccinelle.
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/mtd/spi-nor/cadence-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mtd/spi-nor/cadence-quadspi.c +0
-0
drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_probe(struct platform_device *pdev) · line 1205
Quoted 6 lines
drivers/mtd/spi-nor/cadence-quadspi.c +1
-2@@ -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.
Quoted 5 lines
drivers/mtd/spi-nor/cadence-quadspi.c +1
-0+return irq; } ret =clk_prepare_enable (cqspi->clk);
Signature · 2 lines
Best regards, Marek Vasut