[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250402-al3010-iio-regmap-v4-1-d189bea87261@ixit.cz>
Date: Wed, 02 Apr 2025 21:33:24 +0200
From: David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org>
To: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>
Cc: Svyatoslav Ryhel <clamor95@...il.com>,
Robert Eckelmann <longnoserob@...il.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, David Heidelberg <david@...t.cz>
Subject: [PATCH v4 1/5] iio: light: al3010: Improve al3010_init error
handling with dev_err_probe()
From: David Heidelberg <david@...t.cz>
Minor code simplifications and improved error reporting.
Signed-off-by: David Heidelberg <david@...t.cz>
---
drivers/iio/light/al3010.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
index 8c004a9239aef246a8c6f6c3f4acd6b760ee8249..34a29a51c5f9e8aa143d3ba195b79a19793e4f88 100644
--- a/drivers/iio/light/al3010.c
+++ b/drivers/iio/light/al3010.c
@@ -92,8 +92,8 @@ static int al3010_init(struct al3010_data *data)
ret = devm_add_action_or_reset(&data->client->dev,
al3010_set_pwr_off,
data);
- if (ret < 0)
- return ret;
+ if (ret)
+ return dev_err_probe(&data->client->dev, ret, "failed to add action\n");
ret = i2c_smbus_write_byte_data(data->client, AL3010_REG_CONFIG,
FIELD_PREP(AL3010_GAIN_MASK,
@@ -190,10 +190,8 @@ static int al3010_probe(struct i2c_client *client)
indio_dev->modes = INDIO_DIRECT_MODE;
ret = al3010_init(data);
- if (ret < 0) {
- dev_err(dev, "al3010 chip init failed\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to init ALS\n");
return devm_iio_device_register(dev, indio_dev);
}
--
2.49.0
Powered by blists - more mailing lists