From: Guenter Roeck <linux@roeck-us.net>
To: Fabio Estevam <festevam@gmail.com>
Cc: wim@iguana.be, linux-watchdog@vger.kernel.org,
wsa+renesas@sang-engineering.com, justinpopo6@gmail.com,
Fabio Estevam <fabio.estevam@nxp.com>
Subject: Re: [PATCH 2/2] watchdog: bcm7038: Check the return value from clk_prepare_enable()
Date: Sat, 22 Jul 2017 14:29:06 -0700 [thread overview]
Message-ID: <20170722212906.GC2969@roeck-us.net> (raw)
In-Reply-To: <1500754979-19836-2-git-send-email-festevam@gmail.com>
On Sat, Jul 22, 2017 at 05:22:59PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> 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 <fabio.estevam@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/bcm7038_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c
> index c1b8e534..f88f546 100644
> --- a/drivers/watchdog/bcm7038_wdt.c
> +++ b/drivers/watchdog/bcm7038_wdt.c
> @@ -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
> + if (err)
> + return err;
> wdt->rate = clk_get_rate(wdt->clk);
> /* Prevent divide-by-zero exception */
> if (!wdt->rate)
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-07-22 21:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-22 20:22 [PATCH 1/2] watchdog: renesas-wdt: Check the return value from clk_prepare_enable() Fabio Estevam
2017-07-22 20:22 ` [PATCH 2/2] watchdog: bcm7038: " Fabio Estevam
2017-07-22 21:29 ` Guenter Roeck [this message]
2017-07-22 20:31 ` [PATCH 1/2] watchdog: renesas-wdt: " Wolfram Sang
2017-07-22 21:24 ` Guenter Roeck
2017-07-22 21:28 ` Wolfram Sang
2017-07-22 21:30 ` Guenter Roeck
2017-07-23 14:58 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170722212906.GC2969@roeck-us.net \
--to=linux@roeck-us.net \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=justinpopo6@gmail.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.