drivers/hwmon/i5k_amb.c: fix
PATCH v2 17/17 drivers/hwmon/i5k_amb.c: fix
Signed-off-by Frans Meulenbroeks <[email protected]>
--- drivers/hwmon/i5k_amb.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/i5k_amb.c +15 -3
@@ -159,7 +159,11 @@ static ssize_t store_amb_min(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;
@@ -175,7 +178,11 @@ static ssize_t store_amb_mid(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;
@@ -191,7 +197,11 @@ static ssize_t store_amb_max(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;
Signature · 7 lines
1.7.8.2 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 17/17 v2] drivers/hwmon/i5k_amb.c:
Quoted 38 lines · Frans Meulenbroeks
Signed-off-by Frans Meulenbroeks <[email protected]>--- drivers/hwmon/i5k_amb.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)drivers/hwmon/i5k_amb.c +10
-2@@ -159,7 +159,11 @@ static ssize_t store_amb_min(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;@@ -175,7 +178,11 @@ static ssize_t store_amb_mid(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;@@ -191,7 +197,11 @@ static ssize_t store_amb_max(struct device *dev, {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
drivers/hwmon/i5k_amb.c static ssize_t store_amb_max(struct device *dev, · line 207
Quoted 10 lines
drivers/hwmon/i5k_amb.c +5
-1struct i5k_amb_data *data =dev_get_drvdata (dev); -unsigned long temp =simple_strtoul (buf,NULL ,10 ) /500 ; +unsigned long temp; +int ret =kstrtoul (buf,10 , &temp); +if (ret <0 ) +return ret; + temp = temp /500 ;if (temp >255 ) temp =255 ;
Acked-by Darrick J. Wong <[email protected]>
Quoted 8 lines
1.7.8.2
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors