diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 14:35:53 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:42 -0400 |
commit | 0df9fc7bb8ced5e6fc16a0141d2ee8f6f0eea61c (patch) | |
tree | 72bb677b65f5453a715d3c5ef96019b6684bfab9 | |
parent | f511a21f4ea7d4410241e15db5cb05a287812582 (diff) |
hwmon: (tmp401) 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>
-rw-r--r-- | drivers/hwmon/tmp401.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index ea54c3384671..e62054875164 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c | |||
@@ -594,7 +594,6 @@ static int tmp401_remove(struct i2c_client *client) | |||
594 | &tmp411_attr[i].dev_attr); | 594 | &tmp411_attr[i].dev_attr); |
595 | } | 595 | } |
596 | 596 | ||
597 | kfree(data); | ||
598 | return 0; | 597 | return 0; |
599 | } | 598 | } |
600 | 599 | ||
@@ -605,7 +604,8 @@ static int tmp401_probe(struct i2c_client *client, | |||
605 | struct tmp401_data *data; | 604 | struct tmp401_data *data; |
606 | const char *names[] = { "TMP401", "TMP411" }; | 605 | const char *names[] = { "TMP401", "TMP411" }; |
607 | 606 | ||
608 | data = kzalloc(sizeof(struct tmp401_data), GFP_KERNEL); | 607 | data = devm_kzalloc(&client->dev, sizeof(struct tmp401_data), |
608 | GFP_KERNEL); | ||
609 | if (!data) | 609 | if (!data) |
610 | return -ENOMEM; | 610 | return -ENOMEM; |
611 | 611 | ||
@@ -646,7 +646,7 @@ static int tmp401_probe(struct i2c_client *client, | |||
646 | return 0; | 646 | return 0; |
647 | 647 | ||
648 | exit_remove: | 648 | exit_remove: |
649 | tmp401_remove(client); /* will also free data for us */ | 649 | tmp401_remove(client); |
650 | return err; | 650 | return err; |
651 | } | 651 | } |
652 | 652 | ||