All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: wim@iguana.be
Cc: linux@roeck-us.net, linux-watchdog@vger.kernel.org,
	wsa+renesas@sang-engineering.com, justinpopo6@gmail.com,
	Fabio Estevam <fabio.estevam@nxp.com>
Subject: [PATCH 2/2] watchdog: bcm7038: Check the return value from clk_prepare_enable()
Date: Sat, 22 Jul 2017 17:22:59 -0300	[thread overview]
Message-ID: <1500754979-19836-2-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1500754979-19836-1-git-send-email-festevam@gmail.com>

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>
---
 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);
+		if (err)
+			return err;
 		wdt->rate = clk_get_rate(wdt->clk);
 		/* Prevent divide-by-zero exception */
 		if (!wdt->rate)
-- 
2.7.4


  reply	other threads:[~2017-07-22 20:23 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 ` Fabio Estevam [this message]
2017-07-22 21:29   ` [PATCH 2/2] watchdog: bcm7038: " Guenter Roeck
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=1500754979-19836-2-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=fabio.estevam@nxp.com \
    --cc=justinpopo6@gmail.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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.