Skip to content

Commit 951e395

Browse files
tititiou36nsekhar
authored andcommitted
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: Christophe JAILLET <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
1 parent 66ed86d commit 951e395

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

arch/arm/mach-davinci/board-dm646x-evm.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,15 @@ static int evm_sw_setup(struct i2c_client *client, int gpio,
267267
evm_sw_gpio[i] = gpio++;
268268

269269
status = gpio_direction_input(evm_sw_gpio[i]);
270-
if (status) {
271-
gpio_free(evm_sw_gpio[i]);
272-
evm_sw_gpio[i] = -EINVAL;
270+
if (status)
273271
goto out_free;
274-
}
275272

276273
status = gpio_export(evm_sw_gpio[i], 0);
277-
if (status) {
278-
gpio_free(evm_sw_gpio[i]);
279-
evm_sw_gpio[i] = -EINVAL;
274+
if (status)
280275
goto out_free;
281-
}
282276
}
283-
return status;
277+
return 0;
278+
284279
out_free:
285280
for (i = 0; i < 4; ++i) {
286281
if (evm_sw_gpio[i] != -EINVAL) {

0 commit comments

Comments
 (0)