Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302192
b: refs/heads/master
c: dc553a7
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 10, 2012
1 parent fb7af3c commit 932bd12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 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: 268a164135b0635418ba703f77f4f654ea5abaec
refs/heads/master: dc553a7994e5492237562c7a5400e4b13111ff92
19 changes: 6 additions & 13 deletions trunk/drivers/regulator/max8649.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,18 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
unsigned char data;
int ret;

info = kzalloc(sizeof(struct max8649_regulator_info), GFP_KERNEL);
info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info),
GFP_KERNEL);
if (!info) {
dev_err(&client->dev, "No enough memory\n");
return -ENOMEM;
}

info->regmap = regmap_init_i2c(client, &max8649_regmap_config);
info->regmap = devm_regmap_init_i2c(client, &max8649_regmap_config);
if (IS_ERR(info->regmap)) {
ret = PTR_ERR(info->regmap);
dev_err(&client->dev, "Failed to allocate register map: %d\n", ret);
goto fail;
return ret;
}

info->dev = &client->dev;
Expand Down Expand Up @@ -268,7 +269,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
if (ret != 0) {
dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
ret);
goto out;
return ret;
}
dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", val);

Expand Down Expand Up @@ -306,16 +307,10 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
if (IS_ERR(info->regulator)) {
dev_err(info->dev, "failed to register regulator %s\n",
dcdc_desc.name);
ret = PTR_ERR(info->regulator);
goto out;
return PTR_ERR(info->regulator);
}

return 0;
out:
regmap_exit(info->regmap);
fail:
kfree(info);
return ret;
}

static int __devexit max8649_regulator_remove(struct i2c_client *client)
Expand All @@ -325,8 +320,6 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
if (info) {
if (info->regulator)
regulator_unregister(info->regulator);
regmap_exit(info->regmap);
kfree(info);
}

return 0;
Expand Down

0 comments on commit 932bd12

Please sign in to comment.