Commit 0df9fc7b authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (tmp401) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
parent f511a21f
...@@ -594,7 +594,6 @@ static int tmp401_remove(struct i2c_client *client) ...@@ -594,7 +594,6 @@ static int tmp401_remove(struct i2c_client *client)
&tmp411_attr[i].dev_attr); &tmp411_attr[i].dev_attr);
} }
kfree(data);
return 0; return 0;
} }
...@@ -605,7 +604,8 @@ static int tmp401_probe(struct i2c_client *client, ...@@ -605,7 +604,8 @@ static int tmp401_probe(struct i2c_client *client,
struct tmp401_data *data; struct tmp401_data *data;
const char *names[] = { "TMP401", "TMP411" }; const char *names[] = { "TMP401", "TMP411" };
data = kzalloc(sizeof(struct tmp401_data), GFP_KERNEL); data = devm_kzalloc(&client->dev, sizeof(struct tmp401_data),
GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -646,7 +646,7 @@ static int tmp401_probe(struct i2c_client *client, ...@@ -646,7 +646,7 @@ static int tmp401_probe(struct i2c_client *client,
return 0; return 0;
exit_remove: exit_remove:
tmp401_remove(client); /* will also free data for us */ tmp401_remove(client);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment