diff options
author | Shubhrajyoti D <shubhrajyoti@ti.com> | 2010-10-28 14:31:44 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 14:31:44 -0400 |
commit | e3cd9528af4d1fd404eefe16e52ae421f99a7817 (patch) | |
tree | fe43f5a2ab475769ede0c639dd5823a8c6937bc4 /drivers/hwmon/lm75.c | |
parent | c4f99a2b8fb4c564865f0037a2b7be690d4409f3 (diff) |
hwmon: (lm75) Make the writing to sysfs more robust
Currently we get the checkpatch warning
consider using strict_strtol in preference to simple_strtol.
Also we should not allow any partially numeric values.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm75.c')
-rw-r--r-- | drivers/hwmon/lm75.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index ab5b87a81677..5cb79d94a990 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -103,7 +103,12 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, | |||
103 | struct i2c_client *client = to_i2c_client(dev); | 103 | struct i2c_client *client = to_i2c_client(dev); |
104 | struct lm75_data *data = i2c_get_clientdata(client); | 104 | struct lm75_data *data = i2c_get_clientdata(client); |
105 | int nr = attr->index; | 105 | int nr = attr->index; |
106 | long temp = simple_strtol(buf, NULL, 10); | 106 | long temp; |
107 | int error; | ||
108 | |||
109 | error = strict_strtol(buf, 10, &temp); | ||
110 | if (error) | ||
111 | return error; | ||
107 | 112 | ||
108 | mutex_lock(&data->update_lock); | 113 | mutex_lock(&data->update_lock); |
109 | data->temp[nr] = LM75_TEMP_TO_REG(temp); | 114 | data->temp[nr] = LM75_TEMP_TO_REG(temp); |