[PATCH 3/5] iio: humidity: hts221: Allow unknown whoami for DT fallback
From: Adi Nata
Date: Sat Aug 08 2026 - 05:01:23 EST
The WHOAMI check currently returns -ENODEV when the chip ID is not
0xbc. That rejects Device Tree fallback compatibles.
Keep failing if the WHOAMI register cannot be read. On an unexpected
ID, log it and continue so OF fallback matching can work.
Use dev_err_probe() for the read-failure path.
Signed-off-by: Adi Nata <adinata.softwareengineer@xxxxxxxxx>
---
drivers/iio/humidity/hts221_core.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 76a391f421f5..da773d2edc80 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -139,16 +139,13 @@ static int hts221_check_whoami(struct hts221_hw *hw)
int err, data;
err = regmap_read(hw->regmap, HTS221_REG_WHOAMI_ADDR, &data);
- if (err < 0) {
- dev_err(hw->dev, "failed to read whoami register\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(hw->dev, err,
+ "failed to read whoami register\n");
- if (data != HTS221_REG_WHOAMI_VAL) {
- dev_err(hw->dev, "wrong whoami {%02x vs %02x}\n",
- data, HTS221_REG_WHOAMI_VAL);
- return -ENODEV;
- }
+ if (data != HTS221_REG_WHOAMI_VAL)
+ dev_info(hw->dev,
+ "unexpected whoami 0x%02x, continuing\n", data);
return 0;
}
--
2.47.3