diff mbox series

thermal/drivers: Add error check for reset_control_deassert()

Message ID 20211208153547.3612-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded, archived
Headers show
Series thermal/drivers: Add error check for reset_control_deassert() | expand

Commit Message

Biju Das Dec. 8, 2021, 3:35 p.m. UTC
If reset_control_deassert() fails, then we won't be able to access
the device registers. Therefore check the return code of
reset_control_deassert() and bail out in case of error.

While at it replace the parameter "&pdev->dev" -> "dev" in
devm_reset_control_get_exclusive().

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/thermal/rzg2l_thermal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Philipp Zabel Dec. 8, 2021, 3:39 p.m. UTC | #1
On Wed, 2021-12-08 at 15:35 +0000, Biju Das wrote:
> If reset_control_deassert() fails, then we won't be able to access
> the device registers. Therefore check the return code of
> reset_control_deassert() and bail out in case of error.
> 
> While at it replace the parameter "&pdev->dev" -> "dev" in
> devm_reset_control_get_exclusive().
> 
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks,

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index d47d4a30cd6c..b069cbfa6795 100644
--- a/drivers/thermal/rzg2l_thermal.c
+++ b/drivers/thermal/rzg2l_thermal.c
@@ -170,12 +170,14 @@  static int rzg2l_thermal_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->base);
 
 	priv->dev = dev;
-	priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+	priv->rstc = devm_reset_control_get_exclusive(dev, NULL);
 	if (IS_ERR(priv->rstc))
 		return dev_err_probe(dev, PTR_ERR(priv->rstc),
 				     "failed to get cpg reset");
 
-	reset_control_deassert(priv->rstc);
+	ret = reset_control_deassert(priv->rstc);
+	if (ret)
+		return dev_err_probe(dev, PTR_ERR(ret), "failed to deassert");
 
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);