Re: [PATCH] ALSA: control: Drop redundant stream_open() return check

From: Cezary Rojewski

Date: Thu Jul 02 2026 - 06:38:21 EST


On 7/2/2026 6:46 AM, phucduc.bui@xxxxxxxxx wrote:
From: bui duc phuc <phucduc.bui@xxxxxxxxx>

The previous conversion from nonseekable_open() to stream_open() retained
the existing error check.
Since stream_open() always returns 0, remove the dead error handling path.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/core/control.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index 7a8dc506221e..4cfb0be14c92 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -56,8 +56,6 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
int i, err;
err = stream_open(inode, file);
- if (err < 0)
- return err;

This is a good catch Phuc! Typically such conversions are discouraged as things may change in time but in stream_open() case its documentation clearly states: the function never fails.

While not drop the assignment altogether?

card = snd_lookup_minor_data(iminor(inode), SNDRV_DEVICE_TYPE_CONTROL);
if (!card) {