diff mbox series

ALSA: firewire-motu: fix unreleased lock warning in hwdep device

Message ID 20230130141540.102854-1-o-takashi@sakamocchi.jp
State Accepted
Commit c7a806d9ce6757ff56078674916e53bd859f242d
Headers show
Series ALSA: firewire-motu: fix unreleased lock warning in hwdep device | expand

Commit Message

Takashi Sakamoto Jan. 30, 2023, 2:15 p.m. UTC
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(+)

Comments

Takashi Iwai Jan. 31, 2023, 8:34 a.m. UTC | #1
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
diff mbox series

Patch

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;