Commit 76ba0b89 authored by Lee Jones's avatar Lee Jones Committed by Samuel Ortiz

mfd: adp5520: Convert to managed resources for allocating memory

Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent c211b6b9
...@@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client, ...@@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
...@@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client, ...@@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client,
if (ret) { if (ret) {
dev_err(&client->dev, "failed to request irq %d\n", dev_err(&client->dev, "failed to request irq %d\n",
chip->irq); chip->irq);
goto out_free_chip; return ret;
} }
} }
...@@ -302,9 +302,6 @@ static int adp5520_probe(struct i2c_client *client, ...@@ -302,9 +302,6 @@ static int adp5520_probe(struct i2c_client *client,
if (chip->irq) if (chip->irq)
free_irq(chip->irq, chip); free_irq(chip->irq, chip);
out_free_chip:
kfree(chip);
return ret; return ret;
} }
...@@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client) ...@@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client)
adp5520_remove_subdevs(chip); adp5520_remove_subdevs(chip);
adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment