linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read()
@ 2019-07-15 19:10 Matthias Kaehlcke
  2019-07-15 19:40 ` Doug Anderson
  2019-07-15 19:55 ` Benson Leung
  0 siblings, 2 replies; 7+ messages in thread
From: Matthias Kaehlcke @ 2019-07-15 19:10 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Benson Leung, Enric Balletbo i Serra,
	Guenter Roeck
  Cc: linux-iio, linux-kernel, Gwendal Grignou, Douglas Anderson,
	Matthias Kaehlcke

Before doing any actual work cros_ec_accel_legacy_read() acquires
a mutex, which is released at the end of the function. However for
'calibbias' channels the function returns directly, without releasing
the lock. The next attempt to acquire the lock blocks forever. Instead
of an explicit return statement use the common return path, which
releases the lock.

Fixes: 11b86c7004ef1 ("platform/chrome: Add cros_ec_accel_legacy driver")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 drivers/iio/accel/cros_ec_accel_legacy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c
index 46bb2e421bb9..27ca4a64dddf 100644
--- a/drivers/iio/accel/cros_ec_accel_legacy.c
+++ b/drivers/iio/accel/cros_ec_accel_legacy.c
@@ -206,7 +206,8 @@ static int cros_ec_accel_legacy_read(struct iio_dev *indio_dev,
 	case IIO_CHAN_INFO_CALIBBIAS:
 		/* Calibration not supported. */
 		*val = 0;
-		return IIO_VAL_INT;
+		ret = IIO_VAL_INT;
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.22.0.510.g264f2c817a-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-15 23:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 19:10 [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read() Matthias Kaehlcke
2019-07-15 19:40 ` Doug Anderson
2019-07-15 19:50   ` Matthias Kaehlcke
2019-07-15 19:55 ` Benson Leung
2019-07-15 20:04   ` Matthias Kaehlcke
2019-07-15 23:17     ` Gwendal Grignou
2019-07-15 23:19       ` Gwendal Grignou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).