diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 09:58:02 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-23 21:08:30 -0700 |
commit | 64adf39837c7cf744161b18598577cbe2467a01d (patch) | |
tree | 15f6b3cfc70380c60729c9ba46389b78d04c6407 /drivers/hwmon | |
parent | f9286434ea64803b673bb4ec0dd7084b13c2d90b (diff) |
hwmon: (asb100) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/asb100.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 4b8814deabb..a227be47149 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -787,12 +787,10 @@ static int asb100_probe(struct i2c_client *client, int err; struct asb100_data *data; - data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL); - if (!data) { - pr_debug("probe failed, kzalloc failed!\n"); - err = -ENOMEM; - goto ERROR0; - } + data = devm_kzalloc(&client->dev, sizeof(struct asb100_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->lock); @@ -801,7 +799,7 @@ static int asb100_probe(struct i2c_client *client, /* Attach secondary lm75 clients */ err = asb100_detect_subclients(client); if (err) - goto ERROR1; + return err; /* Initialize the chip */ asb100_init_client(client); @@ -829,9 +827,6 @@ ERROR4: ERROR3: i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[0]); -ERROR1: - kfree(data); -ERROR0: return err; } @@ -845,8 +840,6 @@ static int asb100_remove(struct i2c_client *client) i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[0]); - kfree(data); - return 0; } |