/*
* Driver data (common to all clients)
*/
-
+
static const struct i2c_device_id lm83_id[] = {
{ "lm83", lm83 },
{ "lm82", lm82 },
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct lm83_data *data = i2c_get_clientdata(client);
- long val = simple_strtol(buf, NULL, 10);
+ long val;
int nr = attr->index;
+ int err;
+
+ err = kstrtol(buf, 10, &val);
+ if (err < 0)
+ return err;
mutex_lock(&data->update_lock);
data->temp[nr] = TEMP_TO_REG(val);
* declare 1 and 3 common, and then 2 and 4 only for the LM83.
*/
- if ((err = sysfs_create_group(&new_client->dev.kobj, &lm83_group)))
+ err = sysfs_create_group(&new_client->dev.kobj, &lm83_group);
+ if (err)
goto exit_free;
if (id->driver_data == lm83) {
- if ((err = sysfs_create_group(&new_client->dev.kobj,
- &lm83_group_opt)))
+ err = sysfs_create_group(&new_client->dev.kobj,
+ &lm83_group_opt);
+ if (err)
goto exit_remove_files;
}