From: Guenter Roeck Date: Sat, 2 Jun 2012 16:58:10 +0000 (-0700) Subject: hwmon: (lm90) Convert to use devm_ functions X-Git-Tag: upstream/snapshot3+hdmi~6992^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20f426ff028202b2c0df947a3468ed4717f598d6;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git hwmon: (lm90) Convert to use devm_ functions Convert to use devm_ functions to reduce code size and simplify the code. Cc: Jean Delvare Signed-off-by: Guenter Roeck Acked-by: Jean Delvare --- diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 22b14a68..863412a 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -1399,11 +1399,10 @@ static int lm90_probe(struct i2c_client *client, struct lm90_data *data; int err; - data = kzalloc(sizeof(struct lm90_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct lm90_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + i2c_set_clientdata(client, data); mutex_init(&data->update_lock); @@ -1474,8 +1473,6 @@ exit_remove_files: lm90_remove_files(client, data); exit_restore: lm90_restore_conf(client, data); - kfree(data); -exit: return err; } @@ -1487,7 +1484,6 @@ static int lm90_remove(struct i2c_client *client) lm90_remove_files(client, data); lm90_restore_conf(client, data); - kfree(data); return 0; }