diff mbox series

[5.10.y-cip,12/27] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()

Message ID 20220131121903.8620-13-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State New
Headers show
Series Add RPCIF, SCI{F1} support to Renesas RZ/G2L SoC | expand

Commit Message

Prabhakar Mahadev Lad Jan. 31, 2022, 12:18 p.m. UTC
commit 981387ed06b96908223a607f5fba6efa42728fc2 upstream.

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_hb_probe() callback with error code.

Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20211025205631.21151-5-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/mtd/hyperbus/rpc-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Nobuhiro Iwamatsu Feb. 1, 2022, 3:08 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Sent: Monday, January 31, 2022 9:19 PM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □SWC◯A
> CT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>
> Subject: [PATCH 5.10.y-cip 12/27] mtd: hyperbus: rpc-if: Check return value of
> rpcif_sw_init()
> 
> commit 981387ed06b96908223a607f5fba6efa42728fc2 upstream.
> 
> rpcif_sw_init() can fail so make sure we check the return value of it and on error
> exit rpcif_hb_probe() callback with error code.
> 
> Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Link:
> https://lore.kernel.org/r/20211025205631.21151-5-prabhakar.mahadev-lad.rj
> @bp.renesas.com
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/mtd/hyperbus/rpc-if.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)


> 
> diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
> index ecb050ba95cd..367b0d72bf62 100644
> --- a/drivers/mtd/hyperbus/rpc-if.c
> +++ b/drivers/mtd/hyperbus/rpc-if.c
> @@ -124,7 +124,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
>  	if (!hyperbus)
>  		return -ENOMEM;
> 
> -	rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
> +	error = rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
> +	if (error)
> +		return error;
> 
>  	platform_set_drvdata(pdev, hyperbus);
> 
> --
> 2.17.1

I think we can fix this with stable tree.

Best regards,
  Nobuhiro
diff mbox series

Patch

diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index ecb050ba95cd..367b0d72bf62 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -124,7 +124,9 @@  static int rpcif_hb_probe(struct platform_device *pdev)
 	if (!hyperbus)
 		return -ENOMEM;
 
-	rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	error = rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	if (error)
+		return error;
 
 	platform_set_drvdata(pdev, hyperbus);