Print i2c error when send command to codec.
[bertos.git] / bertos / drv / wm8731.c
index 74a07c4f14ef66102d60df5d86d1cfbb3710e9fa..340ca817c4f353473ada885a0eb63b9d9341132d 100644 (file)
@@ -61,8 +61,9 @@ static void wm8731_write(Wm8731 *ctx, uint8_t reg, uint16_t value)
        i2c_putc(ctx->i2c, (uint8_t)((tmp & 0xFF00) >> 8));
        i2c_putc(ctx->i2c, (uint8_t)(tmp & 0xFF));
 
-       if (i2c_error(ctx->i2c))
-               LOG_ERR("Error while send command to codec.\n");
+       int err = i2c_error(ctx->i2c);
+       if (err)
+               LOG_ERR("Error[%d] while send command to codec.\n", err);
 
 }