[PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure

Fabio Estevam festevam at gmail.com
Fri Oct 17 11:31:09 PDT 2014


From: Fabio Estevam <fabio.estevam at freescale.com>

If spi_nor_match_id fails then we need to propagate an error code into 'ret',
otherwise the probe function will succeed.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index c5d10c3..4a2799f 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -911,8 +911,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 			goto map_failed;
 
 		id = spi_nor_match_id(modalias);
-		if (!id)
+		if (!id) {
+			ret = -EINVAL;
 			goto map_failed;
+		}
 
 		ret = of_property_read_u32(np, "spi-max-frequency",
 				&q->clk_rate);
-- 
1.9.1




More information about the linux-mtd mailing list