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

mfd: adp5520: Convert to managed resources for allocating memory

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Lee Jones and committed by
Samuel Ortiz
76ba0b89 c211b6b9

+2 -6
+2 -6
drivers/mfd/adp5520.c
··· 223 223 return -ENODEV; 224 224 } 225 225 226 - chip = kzalloc(sizeof(*chip), GFP_KERNEL); 226 + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 227 227 if (!chip) 228 228 return -ENOMEM; 229 229 ··· 244 244 if (ret) { 245 245 dev_err(&client->dev, "failed to request irq %d\n", 246 246 chip->irq); 247 - goto out_free_chip; 247 + return ret; 248 248 } 249 249 } 250 250 ··· 302 302 if (chip->irq) 303 303 free_irq(chip->irq, chip); 304 304 305 - out_free_chip: 306 - kfree(chip); 307 - 308 305 return ret; 309 306 } 310 307 ··· 314 317 315 318 adp5520_remove_subdevs(chip); 316 319 adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); 317 - kfree(chip); 318 320 return 0; 319 321 } 320 322