From e25ee68bbd5589b2d2054206fdb0643bffe47469 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 17 Aug 2017 10:20:35 -0500 Subject: [PATCH] arch: arm: stm32f1: Fix how we determine pull-up/pull-down for gpio When we mask out the GPIO High impedance/Pull-up/Pull-down field we should be shifting the mask file, not shifting the field. This is because all the other defines already assume the shift. Coverity-CID: 173640 Jira: ZEP-2538 Signed-off-by: Kumar Gala --- arch/arm/soc/st_stm32/stm32f1/soc_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c b/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c index 2d5eb779d98..73dd1fe8144 100644 --- a/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c +++ b/arch/arm/soc/st_stm32/stm32f1/soc_gpio.c @@ -89,7 +89,7 @@ int stm32_gpio_configure(u32_t *base_addr, int pin, int conf, int altf) mode_io = (conf >> STM32_MODE_INOUT_SHIFT) & STM32_MODE_INOUT_MASK; if (mode_io == STM32_MODE_INPUT) { - int in_pudpd = (conf >> STM32_PUPD_SHIFT) & STM32_PUPD_MASK; + int in_pudpd = conf & (STM32_PUPD_MASK << STM32_PUPD_SHIFT); /* Pin configured in input mode */ /* Mode: 00 */