watchdog: renesas-wdt: Check the return value from clk_prepare_enable()
Subsystems (2)
PATCH 1/2 watchdog: renesas-wdt: Check the return value from clk_prepare_enable()
From: Fabio Estevam <[email protected]>
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
--- drivers/watchdog/renesas_wdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/watchdog/renesas_wdt.c +5 -1
@@ -62,9 +62,13 @@ static int rwdt_init_timeout(struct watchdog_device *wdev)static int rwdt_start (struct watchdog_device *wdev) { +int ret; +struct rwdt_priv *priv =watchdog_get_drvdata (wdev); -clk_prepare_enable (priv->clk); + ret =clk_prepare_enable (priv->clk); +if (ret) +return ret;rwdt_write (priv, priv->cks,RWTCSRA );rwdt_init_timeout (wdev);
Signature · 1 line
2.7.4
PATCH 2/2 watchdog: bcm7038: Check the return value from clk_prepare_enable()
From: Fabio Estevam <[email protected]>
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
--- drivers/watchdog/bcm7038_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/bcm7038_wdt.c +3 -1
@@ -136,7 +136,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) wdt->clk =devm_clk_get (dev,NULL );/* If unable to get clock, use default frequency */ if (!IS_ERR (wdt->clk)) { -clk_prepare_enable (wdt->clk); + err =clk_prepare_enable (wdt->clk); +if (err) +return err; wdt->rate =clk_get_rate (wdt->clk);/* Prevent divide-by-zero exception */ if (!wdt->rate)
Signature · 1 line
2.7.4
Re: [PATCH 2/2] watchdog: bcm7038: Check the return value from clk_prepare_enable()
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
clk_prepare_enable()may fail, so we should better check its return value and propagate it in the case of error.Signed-off-by Fabio Estevam <[email protected]>
Quoted 9 lines
--- drivers/watchdog/bcm7038_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/watchdog/bcm7038_wdt.c +0
-0
drivers/watchdog/bcm7038_wdt.c static int bcm7038_wdt_probe(struct platform_device *pdev) · line 139
Quoted 5 lines
drivers/watchdog/bcm7038_wdt.c +1
-1@@ -136,7 +136,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) wdt->clk =devm_clk_get (dev,NULL );/* If unable to get clock, use default frequency */ if (!IS_ERR (wdt->clk)) { -clk_prepare_enable (wdt->clk); + err =clk_prepare_enable (wdt->clk);
One of those situations where devm_clk_prepare_enable() would be really useful.
Wonder if it would make sense introduce subsystem specific functions, such as devm_watchdog_clk_prepare_enable(). That would at least be better than devm_add_action() in each driver.
Guenter
Quoted 8 lines
drivers/watchdog/bcm7038_wdt.c +2
-0+if (err) +return err; wdt->rate =clk_get_rate (wdt->clk);/* Prevent divide-by-zero exception */ if (!wdt->rate)Signature · 1 line
2.7.4
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
clk_prepare_enable()may fail, so we should better check its return value and propagate it in the case of error.Signed-off-by Fabio Estevam <[email protected]>
True. Yet, I have a patch in preparation which fully switches to RuntimePM which will make manual clk handling superfluous.
I'd prefer to drop this patch because I'd need to revert it anyhow.
Guenter Roeck
maintainerQuoted 11 lines · Wolfram Sang
Quoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
clk_prepare_enable()may fail, so we should better check its return value and propagate it in the case of error.Signed-off-by Fabio Estevam <[email protected]>True. Yet, I have a patch in preparation which fully switches to RuntimePM which will make manual clk handling superfluous.
It won't need clk_prepare_enable() anymore ?
Guenter
Quoted 2 lines
It won't need
clk_prepare_enable()anymore ?
Nope, RuntimePM does all the clock handling.
Guenter Roeck
maintainerQuoted 5 lines · Wolfram Sang
Quoted 2 lines
It won't need
clk_prepare_enable()anymore ?Nope, RuntimePM does all the clock handling.
What if runtime PM is disabled ?
Thanks,
Guenter
Quoted 7 lines · Guenter Roeck
Quoted 5 lines · Wolfram Sang
Quoted 2 lines
It won't need
clk_prepare_enable()anymore ?Nope, RuntimePM does all the clock handling.
What if runtime PM is disabled ?
PM is selected by RENESAS_ARCH.