[PATCH] reset: reset-rzg2l-usbphy-ctrl: Ensure reset line is asserted in error path

From: Prabhakar
Date: Thu Mar 21 2024 - 07:43:38 EST


From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>

In the event of failure during devm_reset_controller_register(), ensure
that the reset line is asserted back.

Fixes: bee08559701fb ("reset: renesas: Add RZ/G2L usbphy control driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
---
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index a8dde4606360..43eb01105596 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -132,8 +132,10 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
priv->rcdev.dev = dev;

error = devm_reset_controller_register(dev, &priv->rcdev);
- if (error)
+ if (error) {
+ reset_control_assert(priv->rstc);
return error;
+ }

spin_lock_init(&priv->lock);
dev_set_drvdata(dev, priv);
--
2.34.1