diff mbox series

i2c: rzv2m: fail probe on reset and runtime-PM errors

Message ID 20260830140709.28745-1-pengpeng@iscas.ac.cn
State New
Headers show
Series i2c: rzv2m: fail probe on reset and runtime-PM errors | expand

Commit Message

Pengpeng Hou Aug. 30, 2026, 2:07 p.m. UTC
Probe ignores reset deassertion and runtime-PM activation failures before
initializing the controller and registering an I2C adapter.

Propagate both required activation errors and disable runtime PM if its
initial resume fails.

Fixes: e0ca796a151b ("i2c: Add Renesas RZ/V2M controller")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/i2c/busses/i2c-rzv2m.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72

Comments

Fabrizio Castro Sept. 1, 2026, 10:40 a.m. UTC | #1
Hi Pengpeng,

Thanks for your patch.

> From: Pengpeng Hou <pengpeng@iscas.ac.cn>
> Sent: 30 August 2026 15:07
> To: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>; Andi Shyti <andi.shyti@kernel.org>; Philipp Zabel
> <p.zabel@pengutronix.de>; linux-i2c@vger.kernel.org; linux-renesas-soc@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] i2c: rzv2m: fail probe on reset and runtime-PM errors
> 
> Probe ignores reset deassertion and runtime-PM activation failures before
> initializing the controller and registering an I2C adapter.
> 
> Propagate both required activation errors and disable runtime PM if its
> initial resume fails.
> 
> Fixes: e0ca796a151b ("i2c: Add Renesas RZ/V2M controller")
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

Did you use an AI tool to generate this patch?

Do you need the `Assisted-by` tag here?

> ---
>  drivers/i2c/busses/i2c-rzv2m.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c
> index 206a99e722a37..81e0101b61946 100644
> --- a/drivers/i2c/busses/i2c-rzv2m.c
> +++ b/drivers/i2c/busses/i2c-rzv2m.c
> @@ -433,7 +433,9 @@ static int rzv2m_i2c_probe(struct platform_device *pdev)
>  	 * The reset also affects other HW that is not under the control
>  	 * of Linux. Therefore, all we can do is deassert the reset.
>  	 */
> -	reset_control_deassert(rstc);
> +	ret = reset_control_deassert(rstc);
> +	if (ret)
> +		return ret;

While the change is sound, the RZ/V2M has a strange SW arrangement.
Half the system is managed by firmware code running on a dedicated core,
the other half of the system is managed by Linux running on its own core.

Some resources are shared between the 2 halves, and the line that separates
the two is sometimes blurry. This patch should be tested against the firmware
code to make sure it's not preventing the I2C controller driver from starting
probing.

I don't have access to the firmware code at the moment, therefore I am inclined
to say that perhaps we shouldn't consider it until somebody is able to properly
test it, as I suspect that the return value of reset_control_deassert() was not
tested for a reason.

Cheers,
Fab

> 
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
> @@ -461,7 +463,11 @@ static int rzv2m_i2c_probe(struct platform_device *pdev)
> 
>  	pm_runtime_enable(dev);
> 
> -	pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0) {
> +		pm_runtime_disable(dev);
> +		return ret;
> +	}
>  	rzv2m_i2c_init(priv);
>  	pm_runtime_put(dev);
> 
> base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
> --
> 2.50.1
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c
index 206a99e722a37..81e0101b61946 100644
--- a/drivers/i2c/busses/i2c-rzv2m.c
+++ b/drivers/i2c/busses/i2c-rzv2m.c
@@ -433,7 +433,9 @@  static int rzv2m_i2c_probe(struct platform_device *pdev)
 	 * The reset also affects other HW that is not under the control
 	 * of Linux. Therefore, all we can do is deassert the reset.
 	 */
-	reset_control_deassert(rstc);
+	ret = reset_control_deassert(rstc);
+	if (ret)
+		return ret;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -461,7 +463,11 @@  static int rzv2m_i2c_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret < 0) {
+		pm_runtime_disable(dev);
+		return ret;
+	}
 	rzv2m_i2c_init(priv);
 	pm_runtime_put(dev);