From b329d6f399249d3f19ec1fa7e7a41f81143c381a Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 29 Oct 2022 23:12:49 +0200
Subject: [PATCH 299/463] iio: st_sensors: Don't report error when the device
 is not present on I2C bus

On Pinephone, this is not an error, because there are two alternate
magentometer configurations.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index c69399ac66572..aed5d60c015d1 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -600,8 +600,16 @@ int st_sensors_verify_id(struct iio_dev *indio_dev)
 		err = regmap_read(sdata->regmap,
 				  sdata->sensor_settings->wai_addr, &wai);
 		if (err < 0) {
+			if (err == -ENXIO) {
+				dev_info(&indio_dev->dev,
+					 "%s is not present on the bus\n",
+					 indio_dev->name);
+				return err;
+			}
+
 			dev_err(&indio_dev->dev,
-				"failed to read Who-Am-I register.\n");
+				"%s: failed to read Who-Am-I register (%d).\n",
+				indio_dev->name, err);
 			return err;
 		}
 
-- 
2.46.0

