Skip to contentSkip to conversation

mtd: fsl-quadspi: Propagate the error from of_modalias_node()

PATCH Applied Fabio Estevam 3 participants 5 messages Oct 17, 2014 – Oct 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mtd: fsl-quadspi: Propagate the error from of_modalias_node()

From: Fabio Estevam <[email protected]>

The 'map_failed' label will return 'ret', so we need to assign the error code to 'ret', otherwise the probe function will return success.

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/fsl-quadspi.c +2 -1
index 8d659a2..c5d10c3 100644
@@ -906,7 +906,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 		nor->prepare = fsl_qspi_prep;
 		nor->unprepare = fsl_qspi_unprep;
 
-		if (of_modalias_node(np, modalias, sizeof(modalias)) < 0)
+		ret = of_modalias_node(np, modalias, sizeof(modalias));
+		if (ret < 0)
 			goto map_failed;
 
 		id = spi_nor_match_id(modalias);
Signature · 1 line
1.9.1
#1 lore raw

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

From: Fabio Estevam <[email protected]>

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

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/fsl-quadspi.c +3 -1
index c5d10c3..4a2799f 100644
@@ -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);
Signature · 1 line
1.9.1
#2 lore raw

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

Quoted 15 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

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

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/fsl-quadspi.c +0 -0
index c5d10c3..4a2799f 100644

drivers/mtd/spi-nor/fsl-quadspi.c static int fsl_qspi_probe(struct platform_device *pdev) · line 917

Quoted 8 lines
drivers/mtd/spi-nor/fsl-quadspi.c +3 -1
@@ -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;
+		}

The call to spi_nor_match_id() was dropped, so this patch is not necessary any more.

drivers/mtd/spi-nor/fsl-quadspi.c static int fsl_qspi_probe(struct platform_device *pdev) · line 920

Quoted 3 lines
drivers/mtd/spi-nor/fsl-quadspi.c +0 -0
 		ret = of_property_read_u32(np, "spi-max-frequency",
 				&q->clk_rate);

Regards,
Brian

Acked-by on v1 1/2
#3 lore raw
In reply to Fabio Estevam
Quoted 27 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

The 'map_failed' label will return 'ret', so we need to assign the error code to 'ret', otherwise the probe function will return success.

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/fsl-quadspi.c +2 -1
index 8d659a2..c5d10c3 100644
@@ -906,7 +906,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 		nor->prepare = fsl_qspi_prep;
 		nor->unprepare = fsl_qspi_unprep;
 
-		if (of_modalias_node(np, modalias, sizeof(modalias)) < 0)
+		ret = of_modalias_node(np, modalias, sizeof(modalias));
+		if (ret < 0)
 			goto map_failed;
 
 		id = spi_nor_match_id(modalias);
Signature · 1 line
1.9.1

thanks, please add my acks to both the patches.