diff options
| author | Andrew Goodbody <[email protected]> | 2025-07-25 13:04:26 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-28 10:32:59 -0600 |
| commit | e8fd262fb3e2c2516610fac6389764e0dbfd98d7 (patch) | |
| tree | 0248db2312c15a9c8506b8a6655dec2dacdb85c2 /drivers/gpio | |
| parent | 23987e10905146def3ab61e55ec912c6e742efdc (diff) | |
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 <[email protected]>
Diffstat (limited to 'drivers/gpio')
| -rw-r--r-- | drivers/gpio/intel_gpio.c | 18 |
1 files changed, 9 insertions, 9 deletions
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); |
