aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83792d.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 14:48:00 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:43 -0400
commit140849e105fd0aadab035923f4cb454ce0518887 (patch)
tree9029dbabbd69f38dee0284918dfc115c106c2548 /drivers/hwmon/w83792d.c
parent144d2b9985d363bd330788356b4ee8ffbf6b0363 (diff)
hwmon: (w83792d) 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> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83792d.c')
-rw-r--r--drivers/hwmon/w83792d.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index ffb5fdfecf0d..0ba5a2bd562e 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1422,11 +1422,9 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)
1422 struct device *dev = &client->dev; 1422 struct device *dev = &client->dev;
1423 int i, val1, err; 1423 int i, val1, err;
1424 1424
1425 data = kzalloc(sizeof(struct w83792d_data), GFP_KERNEL); 1425 data = devm_kzalloc(dev, sizeof(struct w83792d_data), GFP_KERNEL);
1426 if (!data) { 1426 if (!data)
1427 err = -ENOMEM; 1427 return -ENOMEM;
1428 goto ERROR0;
1429 }
1430 1428
1431 i2c_set_clientdata(client, data); 1429 i2c_set_clientdata(client, data);
1432 data->valid = 0; 1430 data->valid = 0;
@@ -1434,7 +1432,7 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)
1434 1432
1435 err = w83792d_detect_subclients(client); 1433 err = w83792d_detect_subclients(client);
1436 if (err) 1434 if (err)
1437 goto ERROR1; 1435 return err;
1438 1436
1439 /* Initialize the chip */ 1437 /* Initialize the chip */
1440 w83792d_init_client(client); 1438 w83792d_init_client(client);
@@ -1448,7 +1446,7 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)
1448 /* Register sysfs hooks */ 1446 /* Register sysfs hooks */
1449 err = sysfs_create_group(&dev->kobj, &w83792d_group); 1447 err = sysfs_create_group(&dev->kobj, &w83792d_group);
1450 if (err) 1448 if (err)
1451 goto ERROR3; 1449 goto exit_i2c_unregister;
1452 1450
1453 /* 1451 /*
1454 * Read GPIO enable register to check if pins for fan 4,5 are used as 1452 * Read GPIO enable register to check if pins for fan 4,5 are used as
@@ -1493,14 +1491,11 @@ exit_remove_files:
1493 sysfs_remove_group(&dev->kobj, &w83792d_group); 1491 sysfs_remove_group(&dev->kobj, &w83792d_group);
1494 for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++) 1492 for (i = 0; i < ARRAY_SIZE(w83792d_group_fan); i++)
1495 sysfs_remove_group(&dev->kobj, &w83792d_group_fan[i]); 1493 sysfs_remove_group(&dev->kobj, &w83792d_group_fan[i]);
1496ERROR3: 1494exit_i2c_unregister:
1497 if (data->lm75[0] != NULL) 1495 if (data->lm75[0] != NULL)
1498 i2c_unregister_device(data->lm75[0]); 1496 i2c_unregister_device(data->lm75[0]);
1499 if (data->lm75[1] != NULL) 1497 if (data->lm75[1] != NULL)
1500 i2c_unregister_device(data->lm75[1]); 1498 i2c_unregister_device(data->lm75[1]);
1501ERROR1:
1502 kfree(data);
1503ERROR0:
1504 return err; 1499 return err;
1505} 1500}
1506 1501
@@ -1521,7 +1516,6 @@ w83792d_remove(struct i2c_client *client)
1521 if (data->lm75[1] != NULL) 1516 if (data->lm75[1] != NULL)
1522 i2c_unregister_device(data->lm75[1]); 1517 i2c_unregister_device(data->lm75[1]);
1523 1518
1524 kfree(data);
1525 return 0; 1519 return 0;
1526} 1520}
1527 1521