* [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node()
@ 2014-10-17 18:31 Fabio Estevam
2014-10-17 18:31 ` [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure Fabio Estevam
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Fabio Estevam @ 2014-10-17 18:31 UTC (permalink / raw)
To: computersforpeace; +Cc: Fabio Estevam, b32955, b45815, linux-mtd
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure
2014-10-17 18:31 [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Fabio Estevam
@ 2014-10-17 18:31 ` Fabio Estevam
2014-10-22 8:52 ` Brian Norris
2014-10-19 2:30 ` [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Huang Shijie
2014-10-22 8:50 ` Brian Norris
2 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2014-10-17 18:31 UTC (permalink / raw)
To: computersforpeace; +Cc: Fabio Estevam, b32955, b45815, linux-mtd
From: Fabio Estevam <fabio.estevam@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@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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node()
2014-10-17 18:31 [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Fabio Estevam
2014-10-17 18:31 ` [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure Fabio Estevam
@ 2014-10-19 2:30 ` Huang Shijie
2014-10-22 8:50 ` Brian Norris
2 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2014-10-19 2:30 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, b32955, b45815, computersforpeace, linux-mtd
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node()
2014-10-17 18:31 [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Fabio Estevam
2014-10-17 18:31 ` [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure Fabio Estevam
2014-10-19 2:30 ` [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Huang Shijie
@ 2014-10-22 8:50 ` Brian Norris
2 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2014-10-22 8:50 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, b32955, b45815, linux-mtd
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure
2014-10-17 18:31 ` [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure Fabio Estevam
@ 2014-10-22 8:52 ` Brian Norris
0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2014-10-22 8:52 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, b32955, b45815, linux-mtd
On Fri, Oct 17, 2014 at 03:31:09PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@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@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;
> + }
The call to spi_nor_match_id() was dropped, so this patch is not
necessary any more.
>
> ret = of_property_read_u32(np, "spi-max-frequency",
> &q->clk_rate);
Regards,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-22 8:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-17 18:31 [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Fabio Estevam
2014-10-17 18:31 ` [PATCH 2/2] mtd: fsl-quadspi: Provide an error code on spi_nor_match_id() failure Fabio Estevam
2014-10-22 8:52 ` Brian Norris
2014-10-19 2:30 ` [PATCH 1/2] mtd: fsl-quadspi: Propagate the error from of_modalias_node() Huang Shijie
2014-10-22 8:50 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox