[PATCH 08/12] iio: light: rohm-bu27034: Fix error return

Matti Vaittinen <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <bfe7f9146960bf0fffb3ce09a14e7912394f5ad8.1786347811.git.mazziesaccount@gmail.com>
From: Matti Vaittinen <[email protected]>

When BU27034 fails to read gain value at integration-time setting, it
returns 0. This leaves caller unaware of the fact that setting the
integration time failed.

Fix this by returning the relevant error instead of zero.

Signed-off-by: Matti Vaittinen <[email protected]>
Fixes: 439c2cef8157 ("iio: bu27034: simplify using guard(mutex)")
---
 drivers/iio/light/rohm-bu27034.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/rohm-bu27034.c b/drivers/iio/light/rohm-bu27034.c
index 28d111ac8c0a..f9a421618406 100644
--- a/drivers/iio/light/rohm-bu27034.c
+++ b/drivers/iio/light/rohm-bu27034.c
@@ -415,7 +415,7 @@ static int bu27034_try_set_int_time(struct bu27034_data *data, int time_us)
 	for (i = 0; i < numg; i++) {
 		ret = bu27034_get_gain(data, gains[i].chan, &gains[i].old_gain);
 		if (ret)
-			return 0;
+			return ret;
 
 		ret = iio_gts_find_new_gain_by_old_gain_time(&data->gts,
 							     gains[i].old_gain,
-- 
2.55.0
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmp5g38ACgkQeFA3/03a
ocWY6Qf9FF8fQGHAYPGF7eXTDSY7Zqv6IehenTPxOWdVZR17cl14h5pF87ufsR5U
avc6KW4XJ2yygWEKDT5BbLt/7o4QlmqObHRVHRLvrHO63yGgCM4RdR5q8EFAZ9kx
Mc0Q1VuEnTJ77i0NNSh88tXvm5KEqYXMWANO/upLMRjbkoqNKL7C4qADSTgFBXkP
zXeTCzkPU65h9U8DZFe92GLDXNE41d/ArP3t75oHnzwiPy8FInVU29D/uB27pF9Z
SALKbuPVB62vVV8pB9b1JOMT3H+dnkvBKmy03wiM5LkKQ2+FTC8LMhdMkbJ7F/Wt
qO1uP3d4MJWf/Ck4hM8x91UN24wioQ==
=WjWi
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.