From 2625996b7556f4b23ff73a8280e867372ab54bc4 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 2 Jun 2012 12:04:07 -0700 Subject: hwmon: (smsc47m192) Convert to use devm_ functions Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck Acked-by: Jean Delvare --- drivers/hwmon/smsc47m192.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'drivers/hwmon') diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c index 4705a8bf11c..36a3478d079 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c @@ -554,11 +554,10 @@ static int smsc47m192_probe(struct i2c_client *client, int config; int err; - data = kzalloc(sizeof(struct smsc47m192_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct smsc47m192_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); data->vrm = vid_which_vrm(); @@ -570,7 +569,7 @@ static int smsc47m192_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &smsc47m192_group); if (err) - goto exit_free; + return err; /* Pin 110 is either in4 (+12V) or VID4 */ config = i2c_smbus_read_byte_data(client, SMSC47M192_REG_CONFIG); @@ -592,9 +591,6 @@ static int smsc47m192_probe(struct i2c_client *client, exit_remove_files: sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); -exit_free: - kfree(data); -exit: return err; } @@ -606,8 +602,6 @@ static int smsc47m192_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &smsc47m192_group); sysfs_remove_group(&client->dev.kobj, &smsc47m192_group_in4); - kfree(data); - return 0; } -- cgit v1.2.3-70-g09d2