From 76ba0b896bed38f7be13682a0170074a5235f1be Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 23 May 2013 16:25:08 +0100 Subject: [PATCH] mfd: adp5520: Convert to managed resources for allocating memory Signed-off-by: Lee Jones Signed-off-by: Samuel Ortiz --- drivers/mfd/adp5520.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index 0d2eba023439..28346ad0b4a6 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c @@ -223,7 +223,7 @@ static int adp5520_probe(struct i2c_client *client, return -ENODEV; } - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -244,7 +244,7 @@ static int adp5520_probe(struct i2c_client *client, if (ret) { dev_err(&client->dev, "failed to request irq %d\n", chip->irq); - goto out_free_chip; + return ret; } } @@ -302,9 +302,6 @@ out_free_irq: if (chip->irq) free_irq(chip->irq, chip); -out_free_chip: - kfree(chip); - return ret; } @@ -317,7 +314,6 @@ static int adp5520_remove(struct i2c_client *client) adp5520_remove_subdevs(chip); adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); - kfree(chip); return 0; }