diff options
Diffstat (limited to 'drivers/hwmon/max6642.c')
-rw-r--r-- | drivers/hwmon/max6642.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/max6642.c b/drivers/hwmon/max6642.c index 4298909a41fd..bf236c0782b7 100644 --- a/drivers/hwmon/max6642.c +++ b/drivers/hwmon/max6642.c | |||
@@ -286,11 +286,10 @@ static int max6642_probe(struct i2c_client *new_client, | |||
286 | struct max6642_data *data; | 286 | struct max6642_data *data; |
287 | int err; | 287 | int err; |
288 | 288 | ||
289 | data = kzalloc(sizeof(struct max6642_data), GFP_KERNEL); | 289 | data = devm_kzalloc(&new_client->dev, sizeof(struct max6642_data), |
290 | if (!data) { | 290 | GFP_KERNEL); |
291 | err = -ENOMEM; | 291 | if (!data) |
292 | goto exit; | 292 | return -ENOMEM; |
293 | } | ||
294 | 293 | ||
295 | i2c_set_clientdata(new_client, data); | 294 | i2c_set_clientdata(new_client, data); |
296 | mutex_init(&data->update_lock); | 295 | mutex_init(&data->update_lock); |
@@ -301,7 +300,7 @@ static int max6642_probe(struct i2c_client *new_client, | |||
301 | /* Register sysfs hooks */ | 300 | /* Register sysfs hooks */ |
302 | err = sysfs_create_group(&new_client->dev.kobj, &max6642_group); | 301 | err = sysfs_create_group(&new_client->dev.kobj, &max6642_group); |
303 | if (err) | 302 | if (err) |
304 | goto exit_free; | 303 | return err; |
305 | 304 | ||
306 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 305 | data->hwmon_dev = hwmon_device_register(&new_client->dev); |
307 | if (IS_ERR(data->hwmon_dev)) { | 306 | if (IS_ERR(data->hwmon_dev)) { |
@@ -313,9 +312,6 @@ static int max6642_probe(struct i2c_client *new_client, | |||
313 | 312 | ||
314 | exit_remove_files: | 313 | exit_remove_files: |
315 | sysfs_remove_group(&new_client->dev.kobj, &max6642_group); | 314 | sysfs_remove_group(&new_client->dev.kobj, &max6642_group); |
316 | exit_free: | ||
317 | kfree(data); | ||
318 | exit: | ||
319 | return err; | 315 | return err; |
320 | } | 316 | } |
321 | 317 | ||
@@ -326,7 +322,6 @@ static int max6642_remove(struct i2c_client *client) | |||
326 | hwmon_device_unregister(data->hwmon_dev); | 322 | hwmon_device_unregister(data->hwmon_dev); |
327 | sysfs_remove_group(&client->dev.kobj, &max6642_group); | 323 | sysfs_remove_group(&client->dev.kobj, &max6642_group); |
328 | 324 | ||
329 | kfree(data); | ||
330 | return 0; | 325 | return 0; |
331 | } | 326 | } |
332 | 327 | ||