Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292224
b: refs/heads/master
c: 918ddef
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck authored and Guenter Roeck committed Mar 19, 2012
1 parent 8e37959 commit ae703cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8a5a7cebded23eb311b8db73a11ed23b4135170
refs/heads/master: 918ddef35f518407d6ed6e72faf6df75e49cee24
23 changes: 7 additions & 16 deletions trunk/drivers/hwmon/max16065.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ static int max16065_probe(struct i2c_client *client,
| I2C_FUNC_SMBUS_READ_WORD_DATA))
return -ENODEV;

data = kzalloc(sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;

Expand All @@ -567,20 +567,16 @@ static int max16065_probe(struct i2c_client *client,

if (have_secondary) {
val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE);
if (unlikely(val < 0)) {
ret = val;
goto out_free;
}
if (unlikely(val < 0))
return val;
secondary_is_max = val & MAX16065_WARNING_OV;
}

/* Read scale registers, convert to range */
for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i++) {
val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i));
if (unlikely(val < 0)) {
ret = val;
goto out_free;
}
if (unlikely(val < 0))
return val;
for (j = 0; j < 4 && i * 4 + j < data->num_adc; j++) {
data->range[i * 4 + j] =
max16065_adc_range[(val >> (j * 2)) & 0x3];
Expand All @@ -595,10 +591,8 @@ static int max16065_probe(struct i2c_client *client,
for (j = 0; j < data->num_adc; j++) {
val = i2c_smbus_read_byte_data(client,
MAX16065_LIMIT(i, j));
if (unlikely(val < 0)) {
ret = val;
goto out_free;
}
if (unlikely(val < 0))
return val;
data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]);
}
}
Expand Down Expand Up @@ -661,8 +655,6 @@ static int max16065_probe(struct i2c_client *client,

out:
max16065_cleanup(client);
out_free:
kfree(data);
return ret;
}

Expand All @@ -672,7 +664,6 @@ static int max16065_remove(struct i2c_client *client)

hwmon_device_unregister(data->hwmon_dev);
max16065_cleanup(client);
kfree(data);

return 0;
}
Expand Down

0 comments on commit ae703cb

Please sign in to comment.