hwmon: (asc7621) Convert to use devm_ functions
authorGuenter Roeck <linux@roeck-us.net>
Sat, 2 Jun 2012 16:58:02 +0000 (09:58 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 22 Jul 2012 04:48:40 +0000 (21:48 -0700)
Convert to use devm_ functions to reduce code size and simplify the code.

Cc: George Joseph <george.joseph@fairview5.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: George Joseph <george.joseph@fairview5.com>
drivers/hwmon/asc7621.c

index 7caa242915a613c4c2d467f5a4d52558997dfec1..b867aab7804975f91fc53f7cc76382f4af39694f 100644 (file)
@@ -1109,7 +1109,8 @@ asc7621_probe(struct i2c_client *client, const struct i2c_device_id *id)
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return -EIO;
 
-       data = kzalloc(sizeof(struct asc7621_data), GFP_KERNEL);
+       data = devm_kzalloc(&client->dev, sizeof(struct asc7621_data),
+                           GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
@@ -1143,7 +1144,6 @@ exit_remove:
                                   &(asc7621_params[i].sda.dev_attr));
        }
 
-       kfree(data);
        return err;
 }
 
@@ -1192,7 +1192,6 @@ static int asc7621_remove(struct i2c_client *client)
                                   &(asc7621_params[i].sda.dev_attr));
        }
 
-       kfree(data);
        return 0;
 }