ALSA: control: Drop redundant stream_open() return check
PATCH 1/1 ALSA: control: Drop redundant stream_open() return check
From: bui duc phuc <[email protected]>
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.
--- sound/core/control.c | 2 -- 1 file changed, 2 deletions(-)
sound/core/control.c +0 -2
@@ -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; card =snd_lookup_minor_data (iminor (inode),SNDRV_DEVICE_TYPE_CONTROL );if (!card) {
Signature · 1 line
2.43.0
Quoted 16 lines · On 7/2/2026 6:46 AM, [email protected] wrote:
From: bui duc phuc <[email protected]>
The previous conversion from
nonseekable_open()tostream_open()retained the existing error check.
Sincestream_open()always returns 0, remove the dead error handling path.Signed-off-by bui duc phuc <[email protected]>--- sound/core/control.c | 2 -- 1 file changed, 2 deletions(-)sound/core/control.c +0
-0
sound/core/control.c static int snd_ctl_open(struct inode *inode, struct file *file) · line 60
Quoted 5 lines
sound/core/control.c +0
-2@@ -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?
Quoted 3 lines
sound/core/control.c +0
-0card =snd_lookup_minor_data (iminor (inode),SNDRV_DEVICE_TYPE_CONTROL );if (!card) {
Hi Cezary,
Thanks for the review!
Quoted 5 lines
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.
I'm just starting to dig deeper into the ALSA core.
Luckily, the very first function I looked at already turned into a patch. :)
I had already received a similar review from Takashi and sent a v2 series.
https://lore.kernel.org/all/[email protected]/
Your review and Takashi-san's pointed out the same issue. Thanks to both of you!
Best,
Bui Duc Phuc