[PATCH] Input: ims-pcu - fix calling interruptible mutex

David Lechner posted 1 patch 2 months, 2 weeks ago
drivers/input/misc/ims-pcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] Input: ims-pcu - fix calling interruptible mutex
Posted by David Lechner 2 months, 2 weeks ago
Fix calling scoped_cond_guard() with mutex instead of mutex_intr.

scoped_cond_guard(mutex, ...) will call mutex_lock() instead of
mutex_lock_interruptible().

Fixes: 703f12672e1f ("Input: ims-pcu - switch to using cleanup functions")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/input/misc/ims-pcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index c086dadb45e3..058f3470b7ae 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1067,7 +1067,7 @@ static ssize_t ims_pcu_attribute_store(struct device *dev,
 	if (data_len > attr->field_length)
 		return -EINVAL;
 
-	scoped_cond_guard(mutex, return -EINTR, &pcu->cmd_mutex) {
+	scoped_cond_guard(mutex_intr, return -EINTR, &pcu->cmd_mutex) {
 		memset(field, 0, attr->field_length);
 		memcpy(field, buf, data_len);
 

---
base-commit: 6708132e80a2ced620bde9b9c36e426183544a23
change-id: 20240910-input-misc-ims-pcu-fix-mutex-intr-9bb7b7a6dda2

Best regards,
-- 
David Lechner <dlechner@baylibre.com>
Re: [PATCH] Input: ims-pcu - fix calling interruptible mutex
Posted by Dmitry Torokhov 2 months, 2 weeks ago
On Tue, Sep 10, 2024 at 04:58:47PM -0500, David Lechner wrote:
> Fix calling scoped_cond_guard() with mutex instead of mutex_intr.
> 
> scoped_cond_guard(mutex, ...) will call mutex_lock() instead of
> mutex_lock_interruptible().
> 
> Fixes: 703f12672e1f ("Input: ims-pcu - switch to using cleanup functions")
> Signed-off-by: David Lechner <dlechner@baylibre.com>

Applied, thank you.

Too bad it does not warn when incorrect type of guard object is being
used with scoped_cond_guard()...

-- 
Dmitry