Skip to content

Commit

Permalink
drivers: gpio: gpio_cy8c95xx: Add error check of i2c_reg_read_byte
Browse files Browse the repository at this point in the history
Check return value from i2c_reg_read_byte and error out if it
received an error

Fixes #35155

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information
galak committed May 14, 2021
1 parent 8152992 commit 21d1ad3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpio/gpio_cy8c95xx.c
Expand Up @@ -257,8 +257,11 @@ static int cy8c95xx_init(const struct device *dev)
goto out;
}

i2c_reg_read_byte(cfg->i2c_master, cfg->i2c_slave_addr,
rc = i2c_reg_read_byte(cfg->i2c_master, cfg->i2c_slave_addr,
CY8C95XX_REG_ID, &data);
if (rc) {
goto out;
}
LOG_DBG("cy8c95xx device ID %02X", data & 0xF0);
if ((data & 0xF0) != 0x20) {
LOG_WRN("driver only support [0-2] ports operations");
Expand Down

0 comments on commit 21d1ad3

Please sign in to comment.