From bad9665198e33a650309d343337288e0b45d037d Mon Sep 17 00:00:00 2001 From: Sergio Rodriguez Date: Thu, 17 Nov 2016 16:06:00 -0800 Subject: [PATCH] soc: stm32f1: gpio: Fix unnecessary else statement The bitfield determining the I/O direction already defines the pin as either input or output, cannot be none or both at the same time This issue was reported by Coverity Coverity-CID: 151970 Change-Id: I18d5387139d6834004ba3269c5b54176bdc97ea7 Signed-off-by: Sergio Rodriguez --- arch/arm/soc/st_stm32/stm32f1/soc_gpio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c b/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c index 303528b9499..c9e461e8ac2 100644 --- a/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c +++ b/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c @@ -87,8 +87,10 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg) } if (direction == GPIO_DIR_OUT) { + /* Pin is configured as an output */ *pincfg = STM32F10X_PIN_CONFIG_DRIVE_PUSH_PULL; - } else if (direction == GPIO_DIR_IN) { + } else { + /* Pin is configured as an input */ int pud = flags & GPIO_PUD_MASK; /* pull-{up,down} maybe? */ @@ -100,8 +102,6 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg) /* floating */ *pincfg = STM32F10X_PIN_CONFIG_BIAS_HIGH_IMPEDANCE; } - } else { - return -ENOTSUP; } return 0;