watchdog: renesas_wdt: check rate also for upper limit

When checking the clock rate, ensure also that counting all 16 bits
takes at least one second to match the granularity of the framework.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Wolfram Sang 2017-07-19 10:27:52 +02:00 коммит произвёл Wim Van Sebroeck
Родитель f6159dd4b0
Коммит b51247c802
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -134,14 +134,14 @@ static int rwdt_probe(struct platform_device *pdev)
for (i = ARRAY_SIZE(clk_divs) - 1; i >= 0; i--) {
clks_per_sec = DIV_ROUND_UP(rate, clk_divs[i]);
if (clks_per_sec) {
if (clks_per_sec && clks_per_sec < 65536) {
priv->clks_per_sec = clks_per_sec;
priv->cks = i;
break;
}
}
if (!clks_per_sec) {
if (i < 0) {
dev_err(&pdev->dev, "Can't find suitable clock divider\n");
return -ERANGE;
}