diff mbox

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

Message ID 1413570669-30738-1-git-send-email-festevam@gmail.com
State Accepted
Headers show

Commit Message

Fabio Estevam Oct. 17, 2014, 6:31 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

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

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

Comments

Huang Shijie Oct. 19, 2014, 2:30 a.m. UTC | #1
On Fri, Oct 17, 2014 at 03:31:08PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> The 'map_failed' label will return 'ret', so we need to assign the error
> code to 'ret', otherwise the probe function will return success.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/mtd/spi-nor/fsl-quadspi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
> index 8d659a2..c5d10c3 100644
> --- a/drivers/mtd/spi-nor/fsl-quadspi.c
> +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
> @@ -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);
> -- 
> 1.9.1
> 
thanks, please add my acks to both the patches.

Acked-by: Huang Shijie <shijie8@gmail.com>
Brian Norris Oct. 22, 2014, 8:50 a.m. UTC | #2
On Fri, Oct 17, 2014 at 03:31:08PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> The 'map_failed' label will return 'ret', so we need to assign the error
> code to 'ret', otherwise the probe function will return success.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Applied to l2-mtd.git

Brian
diff mbox

Patch

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 8d659a2..c5d10c3 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -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);