aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max1668.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:12 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:32 -0400
commit7008b9704ada3d7483358da7a3c7c640e1e0be17 (patch)
tree8d96bfe4002d569cd2029c9c081932b55ef25cd6 /drivers/hwmon/max1668.c
parenta8dd946c420781fd7a70fec8b75e0daf67c4a681 (diff)
hwmon: (max1668) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/max1668.c')
-rw-r--r--drivers/hwmon/max1668.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
index 335b183d7c02..666d9f6263eb 100644
--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -411,7 +411,8 @@ static int max1668_probe(struct i2c_client *client,
411 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 411 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
412 return -ENODEV; 412 return -ENODEV;
413 413
414 data = kzalloc(sizeof(struct max1668_data), GFP_KERNEL); 414 data = devm_kzalloc(&client->dev, sizeof(struct max1668_data),
415 GFP_KERNEL);
415 if (!data) 416 if (!data)
416 return -ENOMEM; 417 return -ENOMEM;
417 418
@@ -422,7 +423,7 @@ static int max1668_probe(struct i2c_client *client,
422 /* Register sysfs hooks */ 423 /* Register sysfs hooks */
423 err = sysfs_create_group(&client->dev.kobj, &max1668_group_common); 424 err = sysfs_create_group(&client->dev.kobj, &max1668_group_common);
424 if (err) 425 if (err)
425 goto error_free; 426 return err;
426 427
427 if (data->type == max1668 || data->type == max1989) { 428 if (data->type == max1668 || data->type == max1989) {
428 err = sysfs_create_group(&client->dev.kobj, 429 err = sysfs_create_group(&client->dev.kobj,
@@ -444,8 +445,6 @@ error_sysrem1:
444 sysfs_remove_group(&client->dev.kobj, &max1668_group_unique); 445 sysfs_remove_group(&client->dev.kobj, &max1668_group_unique);
445error_sysrem0: 446error_sysrem0:
446 sysfs_remove_group(&client->dev.kobj, &max1668_group_common); 447 sysfs_remove_group(&client->dev.kobj, &max1668_group_common);
447error_free:
448 kfree(data);
449 return err; 448 return err;
450} 449}
451 450
@@ -459,7 +458,6 @@ static int max1668_remove(struct i2c_client *client)
459 458
460 sysfs_remove_group(&client->dev.kobj, &max1668_group_common); 459 sysfs_remove_group(&client->dev.kobj, &max1668_group_common);
461 460
462 kfree(data);
463 return 0; 461 return 0;
464} 462}
465 463