Skip to content

Commit 21d1ad3

Browse files
committed
drivers: gpio: gpio_cy8c95xx: Add error check of i2c_reg_read_byte
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>
1 parent 8152992 commit 21d1ad3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpio/gpio_cy8c95xx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ static int cy8c95xx_init(const struct device *dev)
257257
goto out;
258258
}
259259

260-
i2c_reg_read_byte(cfg->i2c_master, cfg->i2c_slave_addr,
260+
rc = i2c_reg_read_byte(cfg->i2c_master, cfg->i2c_slave_addr,
261261
CY8C95XX_REG_ID, &data);
262+
if (rc) {
263+
goto out;
264+
}
262265
LOG_DBG("cy8c95xx device ID %02X", data & 0xF0);
263266
if ((data & 0xF0) != 0x20) {
264267
LOG_WRN("driver only support [0-2] ports operations");

0 commit comments

Comments
 (0)