mfd: Do not leak init_data in tps65912_device_init()
We neglect to free init_data on successful exit. I also moved two assignments to just before they are needed. This avoids doing them in case we hit an earlier error exit from the function. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Cc: Margarita Olaya Cabrera <magi@slimlogic.co.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
2f8491d321
commit
677df0c901
1 changed files with 3 additions and 3 deletions
|
@ -131,9 +131,6 @@ int tps65912_device_init(struct tps65912 *tps65912)
|
||||||
if (init_data == NULL)
|
if (init_data == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
init_data->irq = pmic_plat_data->irq;
|
|
||||||
init_data->irq_base = pmic_plat_data->irq;
|
|
||||||
|
|
||||||
mutex_init(&tps65912->io_mutex);
|
mutex_init(&tps65912->io_mutex);
|
||||||
dev_set_drvdata(tps65912->dev, tps65912);
|
dev_set_drvdata(tps65912->dev, tps65912);
|
||||||
|
|
||||||
|
@ -153,10 +150,13 @@ int tps65912_device_init(struct tps65912 *tps65912)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
init_data->irq = pmic_plat_data->irq;
|
||||||
|
init_data->irq_base = pmic_plat_data->irq;
|
||||||
ret = tps65912_irq_init(tps65912, init_data->irq, init_data);
|
ret = tps65912_irq_init(tps65912, init_data->irq, init_data);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
kfree(init_data);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
|
Loading…
Add table
Reference in a new issue