aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ad7418.c
diff options
context:
space:
mode:
authorFrans Meulenbroeks <fransmeulenbroeks@gmail.com>2012-01-08 13:34:17 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:26:34 -0400
commite91aef22cdb9ca12099d6d21f88de5036fe26fb5 (patch)
treeb886cbb67674e1158905818524dcd07ed70852fb /drivers/hwmon/ad7418.c
parent599654255d4a933e71641b5e3cb8ceb753830c5f (diff)
hwmon: (ad7418) fix checkpatch issues
fixed: WARNING: simple_strtol is obsolete, use kstrtol instead + long temp = simple_strtol(buf, NULL, 10); ERROR: do not use assignment in if condition + if (!(data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL))) { ERROR: do not use assignment in if condition + if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/ad7418.c')
-rw-r--r--drivers/hwmon/ad7418.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c
index 8cb718ce8237..42461d1ff101 100644
--- a/drivers/hwmon/ad7418.c
+++ b/drivers/hwmon/ad7418.c
@@ -167,7 +167,11 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
167 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 167 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
168 struct i2c_client *client = to_i2c_client(dev); 168 struct i2c_client *client = to_i2c_client(dev);
169 struct ad7418_data *data = i2c_get_clientdata(client); 169 struct ad7418_data *data = i2c_get_clientdata(client);
170 long temp = simple_strtol(buf, NULL, 10); 170 long temp;
171 int ret = kstrtol(buf, 10, &temp);
172
173 if (ret < 0)
174 return ret;
171 175
172 mutex_lock(&data->lock); 176 mutex_lock(&data->lock);
173 data->temp[attr->index] = LM75_TEMP_TO_REG(temp); 177 data->temp[attr->index] = LM75_TEMP_TO_REG(temp);
@@ -228,7 +232,8 @@ static int ad7418_probe(struct i2c_client *client,
228 goto exit; 232 goto exit;
229 } 233 }
230 234
231 if (!(data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL))) { 235 data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL);
236 if (!data) {
232 err = -ENOMEM; 237 err = -ENOMEM;
233 goto exit; 238 goto exit;
234 } 239 }
@@ -261,7 +266,8 @@ static int ad7418_probe(struct i2c_client *client,
261 ad7418_init_client(client); 266 ad7418_init_client(client);
262 267
263 /* Register sysfs hooks */ 268 /* Register sysfs hooks */
264 if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) 269 err = sysfs_create_group(&client->dev.kobj, &data->attrs);
270 if (err)
265 goto exit_free; 271 goto exit_free;
266 272
267 data->hwmon_dev = hwmon_device_register(&client->dev); 273 data->hwmon_dev = hwmon_device_register(&client->dev);