aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:10 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:38 -0400
commitc087f73a249154ed83e451343d9eff0f299291a3 (patch)
tree04620f69dc8d093f32f5126ca686e4031b58af49 /drivers
parentadc1413279d124e0940a314ccabebbbee159fd8f (diff)
hwmon: (lm83) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/lm83.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index cd45b9d85584..e998034f1f11 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -343,11 +343,10 @@ static int lm83_probe(struct i2c_client *new_client,
343 struct lm83_data *data; 343 struct lm83_data *data;
344 int err; 344 int err;
345 345
346 data = kzalloc(sizeof(struct lm83_data), GFP_KERNEL); 346 data = devm_kzalloc(&new_client->dev, sizeof(struct lm83_data),
347 if (!data) { 347 GFP_KERNEL);
348 err = -ENOMEM; 348 if (!data)
349 goto exit; 349 return -ENOMEM;
350 }
351 350
352 i2c_set_clientdata(new_client, data); 351 i2c_set_clientdata(new_client, data);
353 data->valid = 0; 352 data->valid = 0;
@@ -362,7 +361,7 @@ static int lm83_probe(struct i2c_client *new_client,
362 361
363 err = sysfs_create_group(&new_client->dev.kobj, &lm83_group); 362 err = sysfs_create_group(&new_client->dev.kobj, &lm83_group);
364 if (err) 363 if (err)
365 goto exit_free; 364 return err;
366 365
367 if (id->driver_data == lm83) { 366 if (id->driver_data == lm83) {
368 err = sysfs_create_group(&new_client->dev.kobj, 367 err = sysfs_create_group(&new_client->dev.kobj,
@@ -382,9 +381,6 @@ static int lm83_probe(struct i2c_client *new_client,
382exit_remove_files: 381exit_remove_files:
383 sysfs_remove_group(&new_client->dev.kobj, &lm83_group); 382 sysfs_remove_group(&new_client->dev.kobj, &lm83_group);
384 sysfs_remove_group(&new_client->dev.kobj, &lm83_group_opt); 383 sysfs_remove_group(&new_client->dev.kobj, &lm83_group_opt);
385exit_free:
386 kfree(data);
387exit:
388 return err; 384 return err;
389} 385}
390 386
@@ -396,7 +392,6 @@ static int lm83_remove(struct i2c_client *client)
396 sysfs_remove_group(&client->dev.kobj, &lm83_group); 392 sysfs_remove_group(&client->dev.kobj, &lm83_group);
397 sysfs_remove_group(&client->dev.kobj, &lm83_group_opt); 393 sysfs_remove_group(&client->dev.kobj, &lm83_group_opt);
398 394
399 kfree(data);
400 return 0; 395 return 0;
401} 396}
402 397