Skip to content

Commit

Permalink
hwmon: (lm90) Convert to use devm_ functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guenter Roeck committed Jul 22, 2012
1 parent c087f73 commit 20f426f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1474,8 +1473,6 @@ static int lm90_probe(struct i2c_client *client,
lm90_remove_files(client, data);
exit_restore:
lm90_restore_conf(client, data);
kfree(data);
exit:
return err;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 20f426f

Please sign in to comment.