diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 13:35:52 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-24 00:08:32 -0400 |
commit | effb8ab114f7ed574f3c033dac642cd2c4ae0021 (patch) | |
tree | 465d1a3f8786d40b54b6e0e4ec116d07f5c30afe | |
parent | d2b95e58ea28eedc126ce9b714e2c7620869fdf4 (diff) |
hwmon: (ltc4245) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/ltc4245.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c index b99b45bafdad..52075914eb0b 100644 --- a/drivers/hwmon/ltc4245.c +++ b/drivers/hwmon/ltc4245.c | |||
@@ -519,11 +519,9 @@ static int ltc4245_probe(struct i2c_client *client, | |||
519 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 519 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
520 | return -ENODEV; | 520 | return -ENODEV; |
521 | 521 | ||
522 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 522 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); |
523 | if (!data) { | 523 | if (!data) |
524 | ret = -ENOMEM; | 524 | return -ENOMEM; |
525 | goto out_kzalloc; | ||
526 | } | ||
527 | 525 | ||
528 | i2c_set_clientdata(client, data); | 526 | i2c_set_clientdata(client, data); |
529 | mutex_init(&data->update_lock); | 527 | mutex_init(&data->update_lock); |
@@ -536,7 +534,7 @@ static int ltc4245_probe(struct i2c_client *client, | |||
536 | /* Register sysfs hooks */ | 534 | /* Register sysfs hooks */ |
537 | ret = ltc4245_sysfs_create_groups(client); | 535 | ret = ltc4245_sysfs_create_groups(client); |
538 | if (ret) | 536 | if (ret) |
539 | goto out_sysfs_create_groups; | 537 | return ret; |
540 | 538 | ||
541 | data->hwmon_dev = hwmon_device_register(&client->dev); | 539 | data->hwmon_dev = hwmon_device_register(&client->dev); |
542 | if (IS_ERR(data->hwmon_dev)) { | 540 | if (IS_ERR(data->hwmon_dev)) { |
@@ -548,9 +546,6 @@ static int ltc4245_probe(struct i2c_client *client, | |||
548 | 546 | ||
549 | out_hwmon_device_register: | 547 | out_hwmon_device_register: |
550 | ltc4245_sysfs_remove_groups(client); | 548 | ltc4245_sysfs_remove_groups(client); |
551 | out_sysfs_create_groups: | ||
552 | kfree(data); | ||
553 | out_kzalloc: | ||
554 | return ret; | 549 | return ret; |
555 | } | 550 | } |
556 | 551 | ||
@@ -560,7 +555,6 @@ static int ltc4245_remove(struct i2c_client *client) | |||
560 | 555 | ||
561 | hwmon_device_unregister(data->hwmon_dev); | 556 | hwmon_device_unregister(data->hwmon_dev); |
562 | ltc4245_sysfs_remove_groups(client); | 557 | ltc4245_sysfs_remove_groups(client); |
563 | kfree(data); | ||
564 | 558 | ||
565 | return 0; | 559 | return 0; |
566 | } | 560 | } |