Re: [PATCH 3/5] iio: humidity: hts221: Allow unknown whoami for DT fallback

From: Andy Shevchenko

Date: Mon Aug 10 2026 - 04:44:37 EST


On Sat, Aug 08, 2026 at 05:00:24PM +0800, Adi Nata wrote:
> 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.

...

> static int hts221_check_whoami(struct hts221_hw *hw)

> int err, data;

With

struct device *dev = hw->dev;

> 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");

return dev_err_probe(dev, err, "failed to read whoami register\n");

(a bit longer, but still fine to have on a single line).

> - 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);

dev_info(dev, "unexpected whoami 0x%02x, continuing\n", data);

--
With Best Regards,
Andy Shevchenko