Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc7e412d authored by Jesper Juhl's avatar Jesper Juhl Committed by Samuel Ortiz
Browse files

mfd: Don't leak init_data in tps65910_i2c_probe



There are a couple of situations where we leak init_data in
drivers/mfd/tps65910.c:tps65910_i2c_probe() - this patch should take
care of them.

Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent f7eb6c5e
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -151,8 +151,10 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
	init_data->irq_base = pmic_plat_data->irq;
	init_data->irq_base = pmic_plat_data->irq;


	tps65910 = kzalloc(sizeof(struct tps65910), GFP_KERNEL);
	tps65910 = kzalloc(sizeof(struct tps65910), GFP_KERNEL);
	if (tps65910 == NULL)
	if (tps65910 == NULL) {
		kfree(init_data);
		return -ENOMEM;
		return -ENOMEM;
	}


	i2c_set_clientdata(i2c, tps65910);
	i2c_set_clientdata(i2c, tps65910);
	tps65910->dev = &i2c->dev;
	tps65910->dev = &i2c->dev;
@@ -174,11 +176,13 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
	if (ret < 0)
	if (ret < 0)
		goto err;
		goto err;


	kfree(init_data);
	return ret;
	return ret;


err:
err:
	mfd_remove_devices(tps65910->dev);
	mfd_remove_devices(tps65910->dev);
	kfree(tps65910);
	kfree(tps65910);
	kfree(init_data);
	return ret;
	return ret;
}
}