Skip to content

Commit

Permalink
mfd: 88pm860x: Drop devm_kfree of devm_kzalloc'd data
Browse files Browse the repository at this point in the history
devm_kfree() allocates memory that is released when a driver detaches.
Thus, there is no reason to explicitly call devm_kfree() in probe or remove
functions.

Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Jingoo Han authored and Samuel Ortiz committed Apr 8, 2013
1 parent c6cc25f commit 8552957
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions drivers/mfd/88pm860x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,17 +1144,15 @@ static int pm860x_probe(struct i2c_client *client,
return -ENOMEM;
ret = pm860x_dt_init(node, &client->dev, pdata);
if (ret)
goto err;
return ret;
} else if (!pdata) {
pr_info("No platform data in %s!\n", __func__);
return -EINVAL;
}

chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL);
if (chip == NULL) {
ret = -ENOMEM;
goto err;
}
if (chip == NULL)
return -ENOMEM;

chip->id = verify_addr(client);
chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config);
Expand Down Expand Up @@ -1194,10 +1192,6 @@ static int pm860x_probe(struct i2c_client *client,

pm860x_device_init(chip, pdata);
return 0;
err:
if (node)
devm_kfree(&client->dev, pdata);
return ret;
}

static int pm860x_remove(struct i2c_client *client)
Expand Down

0 comments on commit 8552957

Please sign in to comment.