Skip to content

Commit 7e3d567

Browse files
ubiedakartben
authored andcommitted
bmp581: Add LOG_ERR if initialization fails
Usually, drivers failing to initialize throw a message in the log, signaling the cause of failure. Add it to this driver so the user isn't confused by no message yet the device being marked as disabled. Signed-off-by: Luis Ubieda <[email protected]>
1 parent d2c4d0c commit 7e3d567

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/sensor/bosch/bmp581/bmp581.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,15 @@ static int bmp581_init(const struct device *dev)
550550
drv->chip_id = 0;
551551
memset(&drv->last_sample, 0, sizeof(drv->last_sample));
552552

553-
soft_reset(dev);
553+
ret = soft_reset(dev);
554+
if (ret != BMP5_OK) {
555+
LOG_ERR("Failed to perform soft-reset: %d", ret);
556+
return ret;
557+
}
554558

555559
ret = bmp581_reg_read_rtio(&conf->bus, BMP5_REG_CHIP_ID, &drv->chip_id, 1);
556560
if (ret != BMP5_OK) {
561+
LOG_ERR("Failed to read chip ID: %d", ret);
557562
return ret;
558563
}
559564

0 commit comments

Comments
 (0)