Commit 951e3956 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Sekhar Nori

ARM: davinci: dm646x-evm: Simplify error handling in 'evm_sw_setup()'

There is no need to call 'gpio_free(evm_sw_gpio[i])' for these error
handling cases, it is already done in the error handling path at label
'out_free'.

Simplify the code and axe a few LoC.

While at it, also explicitly return 0 in the normal path.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 66ed86d6
...@@ -267,20 +267,15 @@ static int evm_sw_setup(struct i2c_client *client, int gpio, ...@@ -267,20 +267,15 @@ static int evm_sw_setup(struct i2c_client *client, int gpio,
evm_sw_gpio[i] = gpio++; evm_sw_gpio[i] = gpio++;
status = gpio_direction_input(evm_sw_gpio[i]); status = gpio_direction_input(evm_sw_gpio[i]);
if (status) { if (status)
gpio_free(evm_sw_gpio[i]);
evm_sw_gpio[i] = -EINVAL;
goto out_free; goto out_free;
}
status = gpio_export(evm_sw_gpio[i], 0); status = gpio_export(evm_sw_gpio[i], 0);
if (status) { if (status)
gpio_free(evm_sw_gpio[i]);
evm_sw_gpio[i] = -EINVAL;
goto out_free; goto out_free;
} }
} return 0;
return status;
out_free: out_free:
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
if (evm_sw_gpio[i] != -EINVAL) { if (evm_sw_gpio[i] != -EINVAL) {
......
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