From: Wim Van Sebroeck <wim@iguana.be>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 5/6] watchdog: atlas7_wdt: test clock rate to avoid division by 0
Date: Sun, 6 Mar 2016 10:09:20 +0100 [thread overview]
Message-ID: <20160306090920.GA1333@spo001.leaseweb.nl> (raw)
In-Reply-To: <1456958018-7849-6-git-send-email-wsa@the-dreams.de>
Hi Wolfram,
> 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/atlas7_wdt.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/watchdog/atlas7_wdt.c b/drivers/watchdog/atlas7_wdt.c
> index df6d9242a31958..ed80734befae16 100644
> --- a/drivers/watchdog/atlas7_wdt.c
> +++ b/drivers/watchdog/atlas7_wdt.c
> @@ -154,6 +154,11 @@ static int atlas7_wdt_probe(struct platform_device *pdev)
> writel(0, wdt->base + ATLAS7_WDT_CNT_CTRL);
>
> wdt->tick_rate = clk_get_rate(clk);
> + if (!wdt->tick_rate) {
> + ret = -EINVAL;
> + goto err1;
> + }
> +
> wdt->clk = clk;
> atlas7_wdd.min_timeout = 1;
> atlas7_wdd.max_timeout = UINT_MAX / wdt->tick_rate;
> --
> 2.7.0
>
Patch has been added to linux-watchdog-next.
Kind regards,
Wim.
next prev parent reply other threads:[~2016-03-06 9:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 22:33 [PATCH 0/6] treewide: " Wolfram Sang
2016-03-02 22:33 ` [PATCH 1/6] ide: palm_bk3710: " Wolfram Sang
2016-03-02 22:33 ` [PATCH 2/6] net: ethernet: renesas: ravb_main: " Wolfram Sang
2016-03-03 11:14 ` Sergei Shtylyov
2016-04-03 21:36 ` Wolfram Sang
2016-04-03 22:28 ` Sergei Shtylyov
2016-03-02 22:33 ` [PATCH 3/6] pwm: pwm-img: " Wolfram Sang
2016-03-04 15:01 ` Thierry Reding
2016-03-02 22:33 ` [PATCH 4/6] pwm: pwm-lpc18xx-sct: " Wolfram Sang
2016-03-02 22:44 ` Joachim Eastwood
2016-03-02 22:58 ` 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 [this message]
2016-03-02 22:33 ` [PATCH 6/6] watchdog: tangox_wdt: " Wolfram Sang
2016-03-03 4:26 ` 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=20160306090920.GA1333@spo001.leaseweb.nl \
--to=wim@iguana.be \
--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=wsa@the-dreams.de \
/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
all inboxes | Powered by JetHome®