Commit 6e13bb06 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (w83791d) Convert to use devm_ functions

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

Cc: Marc Hulsman <m.hulsman@tudelft.nl>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
parent 140849e1
...@@ -1384,18 +1384,17 @@ static int w83791d_probe(struct i2c_client *client, ...@@ -1384,18 +1384,17 @@ static int w83791d_probe(struct i2c_client *client,
(val1 >> 5) & 0x07, (val1 >> 1) & 0x0f, val1); (val1 >> 5) & 0x07, (val1 >> 1) & 0x0f, val1);
#endif #endif
data = kzalloc(sizeof(struct w83791d_data), GFP_KERNEL); data = devm_kzalloc(&client->dev, sizeof(struct w83791d_data),
if (!data) { GFP_KERNEL);
err = -ENOMEM; if (!data)
goto error0; return -ENOMEM;
}
i2c_set_clientdata(client, data); i2c_set_clientdata(client, data);
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
err = w83791d_detect_subclients(client); err = w83791d_detect_subclients(client);
if (err) if (err)
goto error1; return err;
/* Initialize the chip */ /* Initialize the chip */
w83791d_init_client(client); w83791d_init_client(client);
...@@ -1440,9 +1439,6 @@ static int w83791d_probe(struct i2c_client *client, ...@@ -1440,9 +1439,6 @@ static int w83791d_probe(struct i2c_client *client,
i2c_unregister_device(data->lm75[0]); i2c_unregister_device(data->lm75[0]);
if (data->lm75[1] != NULL) if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[1]);
error1:
kfree(data);
error0:
return err; return err;
} }
...@@ -1458,7 +1454,6 @@ static int w83791d_remove(struct i2c_client *client) ...@@ -1458,7 +1454,6 @@ static int w83791d_remove(struct i2c_client *client)
if (data->lm75[1] != NULL) if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[1]);
kfree(data);
return 0; return 0;
} }
......
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