From aaaab4223ebad2470d56d5db2e71c5395d9609b3 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 12 Jun 2013 13:55:43 +0530 Subject: mfd: 88pm860x: Use devm_regmap_init_i2c() devm_regmap_init_i2c() is device managed and makes cleanup simpler. Signed-off-by: Sachin Kamat Signed-off-by: Lee Jones --- drivers/mfd/88pm860x-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/mfd/88pm860x-core.c') diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 31ca55548ef9..629d6404cab4 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1155,7 +1155,7 @@ static int pm860x_probe(struct i2c_client *client, return -ENOMEM; chip->id = verify_addr(client); - chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config); + chip->regmap = devm_regmap_init_i2c(client, &pm860x_regmap_config); if (IS_ERR(chip->regmap)) { ret = PTR_ERR(chip->regmap); dev_err(&client->dev, "Failed to allocate register map: %d\n", @@ -1203,7 +1203,6 @@ static int pm860x_remove(struct i2c_client *client) regmap_exit(chip->regmap_companion); i2c_unregister_device(chip->companion); } - regmap_exit(chip->regmap); kfree(chip); return 0; } -- cgit v1.2.3 From a1ace0aac5a83b859c2ddeb5dfb032b9b6dcd9cf Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 23 May 2013 16:25:03 +0100 Subject: mfd: 88pm860x: Convert to managed resources for allocating memory Signed-off-by: Samuel Ortiz --- drivers/mfd/88pm860x-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/mfd/88pm860x-core.c') diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 629d6404cab4..eeb481d426b5 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1150,7 +1150,8 @@ static int pm860x_probe(struct i2c_client *client, return -EINVAL; } - chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL); + chip = devm_kzalloc(&client->dev, + sizeof(struct pm860x_chip), GFP_KERNEL); if (chip == NULL) return -ENOMEM; @@ -1160,7 +1161,6 @@ static int pm860x_probe(struct i2c_client *client, ret = PTR_ERR(chip->regmap); dev_err(&client->dev, "Failed to allocate register map: %d\n", ret); - kfree(chip); return ret; } chip->client = client; @@ -1203,7 +1203,6 @@ static int pm860x_remove(struct i2c_client *client) regmap_exit(chip->regmap_companion); i2c_unregister_device(chip->companion); } - kfree(chip); return 0; } -- cgit v1.2.3