From: Wolfram Sang <wsa@the-dreams.de>
To: linux-kernel@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
Wim Van Sebroeck <wim@iguana.be>,
Guenter Roeck <linux@roeck-us.net>,
linux-watchdog@vger.kernel.org
Subject: [PATCH 6/6] watchdog: tangox_wdt: test clock rate to avoid division by 0
Date: Wed, 2 Mar 2016 23:33:37 +0100 [thread overview]
Message-ID: <1456958018-7849-7-git-send-email-wsa@the-dreams.de> (raw)
In-Reply-To: <1456958018-7849-1-git-send-email-wsa@the-dreams.de>
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
The clk API may return 0 on clk_get_rate, so we should check the result before
using it as a divisor.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Should go individually via subsystem tree.
drivers/watchdog/tangox_wdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/watchdog/tangox_wdt.c b/drivers/watchdog/tangox_wdt.c
index 709c1ed6fd79b9..cc702718ae4dbb 100644
--- a/drivers/watchdog/tangox_wdt.c
+++ b/drivers/watchdog/tangox_wdt.c
@@ -139,6 +139,8 @@ static int tangox_wdt_probe(struct platform_device *pdev)
return err;
dev->clk_rate = clk_get_rate(dev->clk);
+ if (!dev->clk_rate)
+ return -EINVAL;
dev->wdt.parent = &pdev->dev;
dev->wdt.info = &tangox_wdt_info;
--
2.7.0
next prev parent reply other threads:[~2016-03-02 22:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 22:33 [PATCH 0/6] treewide: test clock rate to avoid division by 0 Wolfram Sang
2016-03-02 22:33 ` [PATCH 5/6] watchdog: atlas7_wdt: " Wolfram Sang
2016-03-03 4:25 ` Guenter Roeck
2016-03-06 9:09 ` Wim Van Sebroeck
2016-03-02 22:33 ` Wolfram Sang [this message]
2016-03-03 4:26 ` [PATCH 6/6] watchdog: tangox_wdt: " Guenter Roeck
2016-03-03 8:12 ` 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=1456958018-7849-7-git-send-email-wsa@the-dreams.de \
--to=wsa@the-dreams.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@iguana.be \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).