All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] thermal/drivers: Add error check for reset_control_deassert()
@ 2021-12-08 16:40 Biju Das
  2021-12-09 15:03 ` Daniel Lezcano
  2021-12-12 11:20 ` [thermal: thermal/next] thermal/drivers/rz2gl: " thermal-bot for Biju Das
  0 siblings, 2 replies; 3+ messages in thread
From: Biju Das @ 2021-12-08 16:40 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: Biju Das, Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria,
	Zhang Rui, linux-pm, Geert Uytterhoeven, Chris Paterson,
	Biju Das, Prabhakar Mahadev Lad, linux-renesas-soc

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>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
v1->v2:
 * removed the cast operation "PTR_ERR(ret)" -> ret
 * Added Rb tag from Philipp.
---
 drivers/thermal/rzg2l_thermal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index d47d4a30cd6c..7a9cdc1f37ca 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, ret, "failed to deassert");
 
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] thermal/drivers: Add error check for reset_control_deassert()
  2021-12-08 16:40 [PATCH v2] thermal/drivers: Add error check for reset_control_deassert() Biju Das
@ 2021-12-09 15:03 ` Daniel Lezcano
  2021-12-12 11:20 ` [thermal: thermal/next] thermal/drivers/rz2gl: " thermal-bot for Biju Das
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2021-12-09 15:03 UTC (permalink / raw)
  To: Biju Das, Philipp Zabel
  Cc: Rafael J. Wysocki, Amit Kucheria, Zhang Rui, linux-pm,
	Geert Uytterhoeven, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, linux-renesas-soc

On 08/12/2021 17:40, 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>
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> v1->v2:
>  * removed the cast operation "PTR_ERR(ret)" -> ret
>  * Added Rb tag from Philipp.
> ---

Applied, thanks


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [thermal: thermal/next] thermal/drivers/rz2gl: Add error check for reset_control_deassert()
  2021-12-08 16:40 [PATCH v2] thermal/drivers: Add error check for reset_control_deassert() Biju Das
  2021-12-09 15:03 ` Daniel Lezcano
@ 2021-12-12 11:20 ` thermal-bot for Biju Das
  1 sibling, 0 replies; 3+ messages in thread
From: thermal-bot for Biju Das @ 2021-12-12 11:20 UTC (permalink / raw)
  To: linux-pm; +Cc: Philipp Zabel, Biju Das, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     8ee1c0f6526ce942b7595951c7bb0165010051c2
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8ee1c0f6526ce942b7595951c7bb0165010051c2
Author:        Biju Das <biju.das.jz@bp.renesas.com>
AuthorDate:    Wed, 08 Dec 2021 16:40:09 
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 09 Dec 2021 15:58:09 +01:00

thermal/drivers/rz2gl: Add error check for reset_control_deassert()

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>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20211208164010.4130-1-biju.das.jz@bp.renesas.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/rzg2l_thermal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index d47d4a3..7a9cdc1 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, ret, "failed to deassert");
 
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-12 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 16:40 [PATCH v2] thermal/drivers: Add error check for reset_control_deassert() Biju Das
2021-12-09 15:03 ` Daniel Lezcano
2021-12-12 11:20 ` [thermal: thermal/next] thermal/drivers/rz2gl: " thermal-bot for Biju Das

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.