aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:13 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:37 -0400
commit94cd52027aa52780e56e11fd08703d955f0ff91e (patch)
treecd433c21aa1d5de66e82a56d659ffa100d388b09
parente7d5bf7ed59ce26d3e6fc12ada497f42efd393ef (diff)
hwmon: (max6650) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Hans J. Koch <hjk@hansjkoch.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Hans J. Koch <hjk@hansjkoch.de>
-rw-r--r--drivers/hwmon/max6650.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 33a8a7f15e18..f739f83bafb9 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -545,7 +545,8 @@ static int max6650_probe(struct i2c_client *client,
545 struct max6650_data *data; 545 struct max6650_data *data;
546 int err; 546 int err;
547 547
548 data = kzalloc(sizeof(struct max6650_data), GFP_KERNEL); 548 data = devm_kzalloc(&client->dev, sizeof(struct max6650_data),
549 GFP_KERNEL);
549 if (!data) { 550 if (!data) {
550 dev_err(&client->dev, "out of memory.\n"); 551 dev_err(&client->dev, "out of memory.\n");
551 return -ENOMEM; 552 return -ENOMEM;
@@ -560,11 +561,11 @@ static int max6650_probe(struct i2c_client *client,
560 */ 561 */
561 err = max6650_init_client(client); 562 err = max6650_init_client(client);
562 if (err) 563 if (err)
563 goto err_free; 564 return err;
564 565
565 err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp); 566 err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp);
566 if (err) 567 if (err)
567 goto err_free; 568 return err;
568 /* 3 additional fan inputs for the MAX6651 */ 569 /* 3 additional fan inputs for the MAX6651 */
569 if (data->nr_fans == 4) { 570 if (data->nr_fans == 4) {
570 err = sysfs_create_group(&client->dev.kobj, &max6651_attr_grp); 571 err = sysfs_create_group(&client->dev.kobj, &max6651_attr_grp);
@@ -582,8 +583,6 @@ static int max6650_probe(struct i2c_client *client,
582 sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); 583 sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp);
583err_remove: 584err_remove:
584 sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); 585 sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp);
585err_free:
586 kfree(data);
587 return err; 586 return err;
588} 587}
589 588
@@ -595,7 +594,6 @@ static int max6650_remove(struct i2c_client *client)
595 if (data->nr_fans == 4) 594 if (data->nr_fans == 4)
596 sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); 595 sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp);
597 sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); 596 sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp);
598 kfree(data);
599 return 0; 597 return 0;
600} 598}
601 599