Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: 88pm860x: Drop devm_kfree of devm_kzalloc'd data

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 <jg1.han@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Jingoo Han and committed by
Samuel Ortiz
85529575 c6cc25fd

+3 -9
+3 -9
drivers/mfd/88pm860x-core.c
··· 1144 1144 return -ENOMEM; 1145 1145 ret = pm860x_dt_init(node, &client->dev, pdata); 1146 1146 if (ret) 1147 - goto err; 1147 + return ret; 1148 1148 } else if (!pdata) { 1149 1149 pr_info("No platform data in %s!\n", __func__); 1150 1150 return -EINVAL; 1151 1151 } 1152 1152 1153 1153 chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL); 1154 - if (chip == NULL) { 1155 - ret = -ENOMEM; 1156 - goto err; 1157 - } 1154 + if (chip == NULL) 1155 + return -ENOMEM; 1158 1156 1159 1157 chip->id = verify_addr(client); 1160 1158 chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config); ··· 1192 1194 1193 1195 pm860x_device_init(chip, pdata); 1194 1196 return 0; 1195 - err: 1196 - if (node) 1197 - devm_kfree(&client->dev, pdata); 1198 - return ret; 1199 1197 } 1200 1198 1201 1199 static int pm860x_remove(struct i2c_client *client)