Re: [PATCH 05/15] serial: sc16is7xx: use guards for simple mutex locks

From: Jiri Slaby

Date: Tue Sep 30 2025 - 00:01:39 EST


On 30. 09. 25, 2:27, Hugo Villeneuve wrote:
@@ -943,9 +937,8 @@ static void sc16is7xx_ms_proc(struct kthread_work *ws)
struct sc16is7xx_port *s = dev_get_drvdata(one->port.dev);
if (one->port.state) {
- mutex_lock(&one->lock);
+ guard(mutex)(&one->lock);
sc16is7xx_update_mlines(one);
- mutex_unlock(&one->lock);
kthread_queue_delayed_work(&s->kworker, &one->ms_work, HZ);

Now the lock is held till here. R U sure it is OK?

Now that you mention it, I am sure its not OK :)

I will restore this one to the original lock/unlock code in V2.

Or use a scoped lock ;).

--
js
suse labs