summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zephyr/emul/emul_isl923x.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/zephyr/emul/emul_isl923x.c b/zephyr/emul/emul_isl923x.c
index 2787c08c5c..9853d57ab1 100644
--- a/zephyr/emul/emul_isl923x.c
+++ b/zephyr/emul/emul_isl923x.c
@@ -380,6 +380,11 @@ static int isl923x_emul_finish_write(const struct emul *emul, int reg,
struct sbat_emul_bat_data *bat;
int16_t current;
+ /* This write only selected register for I2C read message */
+ if (bytes < 2) {
+ return 0;
+ }
+
switch (reg) {
case ISL923X_REG_CHG_CURRENT:
/* Write current to battery. */