diff options
author | Frans Meulenbroeks <fransmeulenbroeks@gmail.com> | 2012-01-08 19:34:17 +0100 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 18:26:34 -0700 |
commit | e91aef22cdb9ca12099d6d21f88de5036fe26fb5 (patch) | |
tree | b886cbb67674e1158905818524dcd07ed70852fb /drivers/hwmon/ad7418.c | |
parent | 599654255d4a933e71641b5e3cb8ceb753830c5f (diff) | |
download | linux-e91aef22cdb9ca12099d6d21f88de5036fe26fb5.tar.bz2 |
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.c | 12 |
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, struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct i2c_client *client = to_i2c_client(dev); struct ad7418_data *data = i2c_get_clientdata(client); - long temp = simple_strtol(buf, NULL, 10); + long temp; + int ret = kstrtol(buf, 10, &temp); + + if (ret < 0) + return ret; mutex_lock(&data->lock); data->temp[attr->index] = LM75_TEMP_TO_REG(temp); @@ -228,7 +232,8 @@ static int ad7418_probe(struct i2c_client *client, goto exit; } - if (!(data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL))) { + data = kzalloc(sizeof(struct ad7418_data), GFP_KERNEL); + if (!data) { err = -ENOMEM; goto exit; } @@ -261,7 +266,8 @@ static int ad7418_probe(struct i2c_client *client, ad7418_init_client(client); /* Register sysfs hooks */ - if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs))) + err = sysfs_create_group(&client->dev.kobj, &data->attrs); + if (err) goto exit_free; data->hwmon_dev = hwmon_device_register(&client->dev); |