[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1590542319-35736-1-git-send-email-yuechao.zhao@advantech.com.cn>
Date: Wed, 27 May 2020 01:18:38 +0000
From: <yuechao.zhao@...antech.com.cn>
To: <345351830@...com>
CC: <amy.shih@...antech.com.tw>, <oakley.ding@...antech.com.tw>,
<jia.sui@...antech.com.cn>,
Yuechao Zhao <yuechao.zhao@...antech.com.cn>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
<linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [v1,1/1 1/2] Check the timeout module parameter is in the min-max range
From: Yuechao Zhao <yuechao.zhao@...antech.com.cn>
Check the return value of 'watchdog_init_timeout()' for checking the
timeout module parameter is in the min-max range.
Signed-off-by: Yuechao Zhao <yuechao.zhao@...antech.com.cn>
---
drivers/hwmon/nct7904.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index 18c95be..d069d59 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -1152,7 +1152,10 @@ static int nct7904_probe(struct i2c_client *client,
data->wdt.max_timeout = MAX_TIMEOUT;
data->wdt.parent = &client->dev;
- watchdog_init_timeout(&data->wdt, timeout * 60, &client->dev);
+ ret = watchdog_init_timeout(&data->wdt, timeout * 60, &client->dev);
+ if (ret < 0)
+ return ret;
+
watchdog_set_nowayout(&data->wdt, nowayout);
watchdog_set_drvdata(&data->wdt, data);
--
1.8.3.1
Powered by blists - more mailing lists