Skip to content

Commit

Permalink
hwmon: (asc7621) Convert to use devm_ functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guenter Roeck committed Jul 22, 2012
1 parent 5ff512b commit 35bb95a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/hwmon/asc7621.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -1143,7 +1144,6 @@ asc7621_probe(struct i2c_client *client, const struct i2c_device_id *id)
&(asc7621_params[i].sda.dev_attr));
}

kfree(data);
return err;
}

Expand Down Expand Up @@ -1192,7 +1192,6 @@ static int asc7621_remove(struct i2c_client *client)
&(asc7621_params[i].sda.dev_attr));
}

kfree(data);
return 0;
}

Expand Down

0 comments on commit 35bb95a

Please sign in to comment.