Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: firewire-motu: fix unreleased lock warning in hwdep device
@ 2023-01-30 14:15 Takashi Sakamoto
  2023-01-31  8:34 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Sakamoto @ 2023-01-30 14:15 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel, Dan Carpenter

Smatch static analysis tool detects that acquired lock is not released
in hwdep device when condition branch is passed due to no event. It is
unlikely to occur, while fulfilling is preferable for better coding.

Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: 634ec0b2906e ("ALSA: firewire-motu: notify event for parameter change in register DSP model")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/motu/motu-hwdep.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/firewire/motu/motu-hwdep.c b/sound/firewire/motu/motu-hwdep.c
index a900fc0e7644..88d1f4b56e4b 100644
--- a/sound/firewire/motu/motu-hwdep.c
+++ b/sound/firewire/motu/motu-hwdep.c
@@ -87,6 +87,10 @@ static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
 			return -EFAULT;
 
 		count = consumed;
+	} else {
+		spin_unlock_irq(&motu->lock);
+
+		count = 0;
 	}
 
 	return count;
-- 
2.37.2


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

* Re: [PATCH] ALSA: firewire-motu: fix unreleased lock warning in hwdep device
  2023-01-30 14:15 [PATCH] ALSA: firewire-motu: fix unreleased lock warning in hwdep device Takashi Sakamoto
@ 2023-01-31  8:34 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2023-01-31  8:34 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, Dan Carpenter

On Mon, 30 Jan 2023 15:15:40 +0100,
Takashi Sakamoto wrote:
> 
> Smatch static analysis tool detects that acquired lock is not released
> in hwdep device when condition branch is passed due to no event. It is
> unlikely to occur, while fulfilling is preferable for better coding.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Fixes: 634ec0b2906e ("ALSA: firewire-motu: notify event for parameter change in register DSP model")
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2023-01-31  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-30 14:15 [PATCH] ALSA: firewire-motu: fix unreleased lock warning in hwdep device Takashi Sakamoto
2023-01-31  8:34 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox