drivers: gpio: npm2100: properly handle I2C write return value
properly check return code from i2c_reg_write_byte_dt effectively making it possible for gpio_npm2100_port_set_masked_raw to error out since: if (ret != 0U) { return ret; } was dead code before this fix. Fixes CID-444376 Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
33ec0276b8
commit
ab9a2f52ba
1 changed files with 2 additions and 2 deletions
|
@ -62,8 +62,8 @@ static int gpio_npm2100_port_set_masked_raw(const struct device *dev, gpio_port_
|
||||||
|
|
||||||
for (size_t idx = 0; idx < NPM2100_GPIO_PINS; idx++) {
|
for (size_t idx = 0; idx < NPM2100_GPIO_PINS; idx++) {
|
||||||
if ((mask & BIT(idx)) != 0U) {
|
if ((mask & BIT(idx)) != 0U) {
|
||||||
i2c_reg_write_byte_dt(&config->i2c, NPM2100_GPIO_OUTPUT + idx,
|
ret = i2c_reg_write_byte_dt(&config->i2c, NPM2100_GPIO_OUTPUT + idx,
|
||||||
!!(value & BIT(idx)));
|
!!(value & BIT(idx)));
|
||||||
if (ret != 0U) {
|
if (ret != 0U) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue