2022-06-17 09:35:47

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH v2] mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path

If rpcif_hw_init() fails, Runtime PM is left enabled.

Fixes: b04cc0d912eb80d3 ("memory: renesas-rpc-if: Add support for RZ/G2L")
Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Wolfram Sang <[email protected]>
Reviewed-by: Lad Prabhakar <[email protected]>
---
v2:
- Add Reviewed-by.
---
drivers/mtd/hyperbus/rpc-if.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index 6e08ec1d4f098c80..b70d259e48a7c728 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -134,7 +134,7 @@ static int rpcif_hb_probe(struct platform_device *pdev)

error = rpcif_hw_init(&hyperbus->rpc, true);
if (error)
- return error;
+ goto out_disable_rpm;

hyperbus->hbdev.map.size = hyperbus->rpc.size;
hyperbus->hbdev.map.virt = hyperbus->rpc.dirmap;
@@ -145,8 +145,12 @@ static int rpcif_hb_probe(struct platform_device *pdev)
hyperbus->hbdev.np = of_get_next_child(pdev->dev.parent->of_node, NULL);
error = hyperbus_register_device(&hyperbus->hbdev);
if (error)
- rpcif_disable_rpm(&hyperbus->rpc);
+ goto out_disable_rpm;
+
+ return 0;

+out_disable_rpm:
+ rpcif_disable_rpm(&hyperbus->rpc);
return error;
}

--
2.25.1


2022-06-17 12:53:30

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH v2] mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path

Hello!

On 6/17/22 12:26 PM, Geert Uytterhoeven wrote:

> If rpcif_hw_init() fails, Runtime PM is left enabled.
>
> Fixes: b04cc0d912eb80d3 ("memory: renesas-rpc-if: Add support for RZ/G2L")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Reviewed-by: Wolfram Sang <[email protected]>
> Reviewed-by: Lad Prabhakar <[email protected]>

Reviewed-by: Sergey Shtylyov <[email protected]>

[...]

MBR, Sergey

2022-06-24 19:05:59

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH v2] mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path

From: Miquel Raynal <[email protected]>

On Fri, 2022-06-17 at 09:26:51 UTC, Geert Uytterhoeven wrote:
> If rpcif_hw_init() fails, Runtime PM is left enabled.
>
> Fixes: b04cc0d912eb80d3 ("memory: renesas-rpc-if: Add support for RZ/G2L")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Reviewed-by: Wolfram Sang <[email protected]>
> Reviewed-by: Lad Prabhakar <[email protected]>
> Reviewed-by: Sergey Shtylyov <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel