提交 05639bcb 编写于 作者: G Guenter Roeck

hwmon: (f75375s) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.

Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 33cd66e3
...@@ -838,7 +838,8 @@ static int f75375_probe(struct i2c_client *client, ...@@ -838,7 +838,8 @@ static int f75375_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE_DATA)) I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO; return -EIO;
data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL); data = devm_kzalloc(&client->dev, sizeof(struct f75375_data),
GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -848,7 +849,7 @@ static int f75375_probe(struct i2c_client *client, ...@@ -848,7 +849,7 @@ static int f75375_probe(struct i2c_client *client,
err = sysfs_create_group(&client->dev.kobj, &f75375_group); err = sysfs_create_group(&client->dev.kobj, &f75375_group);
if (err) if (err)
goto exit_free; return err;
if (data->kind != f75373) { if (data->kind != f75373) {
err = sysfs_chmod_file(&client->dev.kobj, err = sysfs_chmod_file(&client->dev.kobj,
...@@ -875,8 +876,6 @@ static int f75375_probe(struct i2c_client *client, ...@@ -875,8 +876,6 @@ static int f75375_probe(struct i2c_client *client,
exit_remove: exit_remove:
sysfs_remove_group(&client->dev.kobj, &f75375_group); sysfs_remove_group(&client->dev.kobj, &f75375_group);
exit_free:
kfree(data);
return err; return err;
} }
...@@ -885,7 +884,6 @@ static int f75375_remove(struct i2c_client *client) ...@@ -885,7 +884,6 @@ static int f75375_remove(struct i2c_client *client)
struct f75375_data *data = i2c_get_clientdata(client); struct f75375_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev); hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &f75375_group); sysfs_remove_group(&client->dev.kobj, &f75375_group);
kfree(data);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册