summaryrefslogtreecommitdiff
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2020-03-21 09:58:36 +0100
committerSekhar Nori <nsekhar@ti.com>2020-07-22 00:34:21 +0530
commit951e3956863270f664eea42dd359fea6402ce59c (patch)
treed7563ea9f1aba2817b724ae9cc4a42042ee249ed /arch/arm/mach-davinci
parent66ed86d6377abdf7a2dd8e2654e5a90e65201cd7 (diff)
downloadlinux-951e3956863270f664eea42dd359fea6402ce59c.tar.gz
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 <christophe.jaillet@wanadoo.fr> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 4600b617f9b4..dd7d60f4139a 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -267,20 +267,15 @@ static int evm_sw_setup(struct i2c_client *client, int gpio,
evm_sw_gpio[i] = gpio++;
status = gpio_direction_input(evm_sw_gpio[i]);
- if (status) {
- gpio_free(evm_sw_gpio[i]);
- evm_sw_gpio[i] = -EINVAL;
+ if (status)
goto out_free;
- }
status = gpio_export(evm_sw_gpio[i], 0);
- if (status) {
- gpio_free(evm_sw_gpio[i]);
- evm_sw_gpio[i] = -EINVAL;
+ if (status)
goto out_free;
- }
}
- return status;
+ return 0;
+
out_free:
for (i = 0; i < 4; ++i) {
if (evm_sw_gpio[i] != -EINVAL) {