hwmon: (lm90) Convert to use devm_ functions
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>
This commit is contained in:
parent
c087f73a24
commit
20f426ff02
|
@ -1399,11 +1399,10 @@ static int lm90_probe(struct i2c_client *client,
|
||||||
struct lm90_data *data;
|
struct lm90_data *data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
data = kzalloc(sizeof(struct lm90_data), GFP_KERNEL);
|
data = devm_kzalloc(&client->dev, sizeof(struct lm90_data), GFP_KERNEL);
|
||||||
if (!data) {
|
if (!data)
|
||||||
err = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
i2c_set_clientdata(client, data);
|
i2c_set_clientdata(client, data);
|
||||||
mutex_init(&data->update_lock);
|
mutex_init(&data->update_lock);
|
||||||
|
|
||||||
|
@ -1474,8 +1473,6 @@ exit_remove_files:
|
||||||
lm90_remove_files(client, data);
|
lm90_remove_files(client, data);
|
||||||
exit_restore:
|
exit_restore:
|
||||||
lm90_restore_conf(client, data);
|
lm90_restore_conf(client, data);
|
||||||
kfree(data);
|
|
||||||
exit:
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1487,7 +1484,6 @@ static int lm90_remove(struct i2c_client *client)
|
||||||
lm90_remove_files(client, data);
|
lm90_remove_files(client, data);
|
||||||
lm90_restore_conf(client, data);
|
lm90_restore_conf(client, data);
|
||||||
|
|
||||||
kfree(data);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue