watchdog: tangox_wdt: test clock rate to avoid division by 0
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 3 Mar 2016 08:24:12 +0000 (09:24 +0100)
committerWim Van Sebroeck <wim@iguana.be>
Wed, 16 Mar 2016 20:09:16 +0000 (21:09 +0100)
commit84b84bcf4f718b7b9f5296d4068025fea801a0e1
treee6f039e2e02679d26a63c4757245cf8aa4281c8f
parentccc8208d0855a5b02a4fc49c141b6f1dbf282304
watchdog: tangox_wdt: test clock rate to avoid division by 0

The clk API may return 0 on clk_get_rate, so we should check the result before
using it as a divisor. For this, refactor the code to use a central
error path.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/tangox_wdt.c