Skip to content

Commit

Permalink
drivers: gpio: fix misuse of u8_t where bool is intended
Browse files Browse the repository at this point in the history
GPIO configuration flags will move and some that used to be in the low
8 bits are now higher, resulting in implicit constant conversion
overflows.  Use a boolean data type to hold boolean values.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
  • Loading branch information
pabigot committed Feb 5, 2019
1 parent aa82696 commit ed85ff7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static inline void dw_interrupt_config(struct device *port, int access_op,
struct gpio_dw_runtime *context = port->driver_data;
const struct gpio_dw_config *config = port->config->config_info;
u32_t base_addr = dw_base_to_block_base(context->base_addr);
u8_t flag_is_set;
bool flag_is_set;

ARG_UNUSED(access_op);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_qmsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void gpio_qmsi_callback(void *data, u32_t status)
}
}

static void qmsi_write_bit(u32_t *target, u8_t bit, u8_t value)
static void qmsi_write_bit(u32_t *target, u8_t bit, bool value)
{
if (value) {
sys_set_bit((uintptr_t) target, bit);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio_qmsi_ss.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static void ss_gpio_qmsi_callback(void *data, uint32_t status)
}
}

static void ss_qmsi_write_bit(u32_t *target, u8_t bit, u8_t value)
static void ss_qmsi_write_bit(u32_t *target, u8_t bit, bool value)
{
if (value) {
sys_set_bit((uintptr_t) target, bit);
Expand Down

0 comments on commit ed85ff7

Please sign in to comment.