[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231004-staging-iio-resolver-ad2s1210-fix-return-with-lock-held-v1-1-812b932997bd@baylibre.com>
Date: Wed, 4 Oct 2023 09:17:26 -0500
From: David Lechner <dlechner@...libre.com>
To: linux-iio@...r.kernel.org, linux-staging@...ts.linux.dev
Cc: David Lechner <dlechner@...libre.com>,
Jonathan Cameron <jic23@...nel.org>,
Michael Hennerich <Michael.Hennerich@...log.com>,
linux-kernel@...r.kernel.org, kernel test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: [PATCH] staging: iio: resolver: ad2s1210: fix return with lock held
We missed a return statement in ad2s1210_initial() that would cause
the lock to be held when returning an error.
This is fixed by replacing the return with a goto to release the lock
before returning.
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/202310030222.iokamE9T-lkp@intel.com/
Fixes: 0d03d0e65846 ("staging: iio: resolver: ad2s1210: rework gpios")
Signed-off-by: David Lechner <dlechner@...libre.com>
---
drivers/staging/iio/resolver/ad2s1210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 98afd2e9ea41..67d8af0dd7ae 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -555,7 +555,7 @@ static int ad2s1210_initial(struct ad2s1210_state *st)
mutex_lock(&st->lock);
ret = ad2s1210_set_resolution_gpios(st, st->resolution);
if (ret < 0)
- return ret;
+ goto error_ret;
/* Use default config register value plus resolution from devicetree. */
data = FIELD_PREP(AD2S1210_PHASE_LOCK_RANGE_44, 1);
---
base-commit: a533eeaef80e879b3ad1937eee7a43d1f9961c5d
change-id: 20231004-staging-iio-resolver-ad2s1210-fix-return-with-lock-held-f547ce6fae49
Powered by blists - more mailing lists