Commit b1224cd1 authored by Jesper Juhl's avatar Jesper Juhl Committed by Samuel Ortiz

mfd: Avoid two assignments if failures happen in tps65910_i2c_probe

In drivers/mfd/tps65910.c:tps65910_i2c_probe() there's potential for a
tiny optimization.

We assign to init_data->irq and init_data->irq_base long before we
need them, and there are two potential exits from the function before
they are needed.

Moving the assignments below these two potential exits means we
completely avoid doing them in these two (failure) cases.
Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Acked-by: default avatarGraeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 6daa663d
...@@ -147,9 +147,6 @@ static int tps65910_i2c_probe(struct i2c_client *i2c, ...@@ -147,9 +147,6 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
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;
tps65910 = kzalloc(sizeof(struct tps65910), GFP_KERNEL); tps65910 = kzalloc(sizeof(struct tps65910), GFP_KERNEL);
if (tps65910 == NULL) { if (tps65910 == NULL) {
kfree(init_data); kfree(init_data);
...@@ -170,6 +167,9 @@ static int tps65910_i2c_probe(struct i2c_client *i2c, ...@@ -170,6 +167,9 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
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;
tps65910_gpio_init(tps65910, pmic_plat_data->gpio_base); tps65910_gpio_init(tps65910, pmic_plat_data->gpio_base);
ret = tps65910_irq_init(tps65910, init_data->irq, init_data); ret = tps65910_irq_init(tps65910, init_data->irq, init_data);
......
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