Skip to content

Commit 62c0fc3

Browse files
zeonchewcarlescufi
authored andcommitted
drivers: gpio_ambiq: Fixed uninitialized return variable
Fixed uninitialized return value variable issue, which would cause functions to wrongly return non-zero value despite a successful execution. Signed-off-by: Chew Zeh Yang <zeon.chew@ambiq.com>
1 parent d250664 commit 62c0fc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpio/gpio_ambiq.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct ambiq_gpio_data {
3636
static int ambiq_gpio_pin_configure(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags)
3737
{
3838
const struct ambiq_gpio_config *const dev_cfg = dev->config;
39-
int ret;
39+
int ret = 0;
4040

4141
#if defined(CONFIG_SOC_SERIES_APOLLO3X)
4242
pin += dev_cfg->offset;
@@ -392,7 +392,7 @@ static int ambiq_gpio_pin_interrupt_configure(const struct device *dev, gpio_pin
392392
const struct ambiq_gpio_config *const dev_cfg = dev->config;
393393
struct ambiq_gpio_data *const data = dev->data;
394394

395-
int ret;
395+
int ret = 0;
396396
#if defined(CONFIG_SOC_SERIES_APOLLO3X)
397397
am_hal_gpio_pincfg_t pincfg = g_AM_HAL_GPIO_DEFAULT;
398398
int gpio_pin = pin + dev_cfg->offset;

0 commit comments

Comments
 (0)