From: Andrew Goodbody Date: Fri, 25 Jul 2025 12:04:26 +0000 (+0100) Subject: gpio: intel_gpio: Initialise or0 and or1 X-Git-Tag: v2026.01-rc2~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8fd262fb3e2c2516610fac6389764e0dbfd98d7;p=thirdparty%2Fu-boot.git gpio: intel_gpio: Initialise or0 and or1 In intel_gpio_set_flags the two variables or0 and or1 may be used uninitialised. Correct this by setting initial values in the declaration. Also there is no need to use '|=' when the initial value is 0 and there is only one assignment performed to each variable so just use '=' instead. This issue was found by Smatch. Signed-off-by: Andrew Goodbody --- diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index 0ab6e8a90bc..ac2fb8bc2cc 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -116,26 +116,26 @@ static int intel_gpio_set_flags(struct udevice *dev, unsigned int offset, { struct udevice *pinctrl = dev_get_parent(dev); u32 bic0 = 0, bic1 = 0; - u32 or0, or1; + u32 or0 = 0, or1 = 0; uint config_offset; config_offset = intel_pinctrl_get_config_reg_offset(pinctrl, offset); if (flags & GPIOD_IS_OUT) { - bic0 |= PAD_CFG0_MODE_MASK | PAD_CFG0_RX_STATE | + bic0 = PAD_CFG0_MODE_MASK | PAD_CFG0_RX_STATE | PAD_CFG0_TX_DISABLE; - or0 |= PAD_CFG0_MODE_GPIO | PAD_CFG0_RX_DISABLE; + or0 = PAD_CFG0_MODE_GPIO | PAD_CFG0_RX_DISABLE; } else if (flags & GPIOD_IS_IN) { - bic0 |= PAD_CFG0_MODE_MASK | PAD_CFG0_TX_STATE | + bic0 = PAD_CFG0_MODE_MASK | PAD_CFG0_TX_STATE | PAD_CFG0_RX_DISABLE; - or0 |= PAD_CFG0_MODE_GPIO | PAD_CFG0_TX_DISABLE; + or0 = PAD_CFG0_MODE_GPIO | PAD_CFG0_TX_DISABLE; } if (flags & GPIOD_PULL_UP) { - bic1 |= PAD_CFG1_PULL_MASK; - or1 |= PAD_CFG1_PULL_UP_20K; + bic1 = PAD_CFG1_PULL_MASK; + or1 = PAD_CFG1_PULL_UP_20K; } else if (flags & GPIOD_PULL_DOWN) { - bic1 |= PAD_CFG1_PULL_MASK; - or1 |= PAD_CFG1_PULL_DN_20K; + bic1 = PAD_CFG1_PULL_MASK; + or1 = PAD_CFG1_PULL_DN_20K; } pcr_clrsetbits32(pinctrl, PAD_CFG0_OFFSET(config_offset), bic0, or0);