Skip to content

Commit 57f3884

Browse files
thugheskartben
authored andcommitted
drivers: mfd: mfd_adp5585: Fix -Wsometimes-uninitialized warning
When building with clang it warns: drivers/mfd/mfd_adp5585.c:59:6: error: variable 'reg_int_status' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (ret == 0) { ^~~~~~~~ drivers/mfd/mfd_adp5585.c:70:7: note: uninitialized use occurs here if ((reg_int_status & ADP5585_INT_GPI) ^~~~~~~~~~~~~~ && device_is_ready(data->child.gpio_dev)) { drivers/mfd/mfd_adp5585.c:59:2: note: remove the 'if' if its condition is always true if (ret == 0) { ^~~~~~~~~~~~~~ drivers/mfd/mfd_adp5585.c:54:24: note: initialize the variable 'reg_int_status' to silence this warning uint8_t reg_int_status; ^ = '\0' Signed-off-by: Tom Hughes <[email protected]>
1 parent ff2cf4b commit 57f3884

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/mfd/mfd_adp5585.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ static void mfd_adp5585_work_handler(struct k_work *work)
5656

5757
k_sem_take(&data->lock, K_FOREVER);
5858
/* Read Interrput Flag */
59-
if (ret == 0) {
60-
ret = i2c_reg_read_byte_dt(&config->i2c_bus, ADP5585_INT_STATUS, &reg_int_status);
61-
}
59+
ret = i2c_reg_read_byte_dt(&config->i2c_bus, ADP5585_INT_STATUS, &reg_int_status);
60+
6261
/* Clear Interrput Flag */
6362
if (ret == 0) {
6463
ret = i2c_reg_write_byte_dt(&config->i2c_bus, ADP5585_INT_STATUS, reg_int_status);

0 commit comments

Comments
 (0)