ALSA: pcm: Drop reduntant nonseekable_open() return check
PATCH 1/1 ALSA: pcm: Drop reduntant nonseekable_open() return check
From: bui duc phuc <[email protected]>
nonseekable_open() always returns 0, so the error check is unnecessary. Remove the dead error handling path.
--- sound/core/pcm_native.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/core/pcm_native.c +2 -4
@@ -2874,8 +2874,7 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) {struct snd_pcm *pcm;int err =nonseekable_open (inode, file); -if (err <0 ) -return err; + pcm =snd_lookup_minor_data (iminor (inode),SNDRV_DEVICE_TYPE_PCM_PLAYBACK ); err =snd_pcm_open (file, pcm,SNDRV_PCM_STREAM_PLAYBACK );
@@ -2888,8 +2887,7 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) {struct snd_pcm *pcm;int err =nonseekable_open (inode, file); -if (err <0 ) -return err; + pcm =snd_lookup_minor_data (iminor (inode),SNDRV_DEVICE_TYPE_PCM_CAPTURE ); err =snd_pcm_open (file, pcm,SNDRV_PCM_STREAM_CAPTURE );
Signature · 1 line
2.43.0
Quoted 16 lines · On Thu, 02 Jul 2026 05:57:04 +0200, [email protected] wrote:
From: bui duc phuc <[email protected]>
nonseekable_open()always returns 0, so the error check is unnecessary. Remove the dead error handling path.Signed-off-by bui duc phuc <[email protected]>--- sound/core/pcm_native.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)sound/core/pcm_native.c +0
-0
sound/core/pcm_native.c static int snd_pcm_playback_open(struct inode *inode, struct file *file) · line 2877
Quoted 6 lines
sound/core/pcm_native.c +1
-2@@ -2874,8 +2874,7 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) {struct snd_pcm *pcm;int err =nonseekable_open (inode, file); -if (err <0 ) -return err; +
We don't have to assign err here, right?
Keeping it looks rather confusing.
sound/core/pcm_native.c static int snd_pcm_capture_open(struct inode *inode, struct file *file) · line 2890
Quoted 10 lines
sound/core/pcm_native.c +1
-2pcm =snd_lookup_minor_data (iminor (inode),SNDRV_DEVICE_TYPE_PCM_PLAYBACK ); err =snd_pcm_open (file, pcm,SNDRV_PCM_STREAM_PLAYBACK );@@ -2888,8 +2887,7 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) {struct snd_pcm *pcm;int err =nonseekable_open (inode, file); -if (err <0 ) -return err; +
Ditto.
I see a similar pattern in your other patches. Please try to address it and resubmit -- at best, as a v2 series of patches.
thanks,
Takashi
Hi Takashi-san,
Thank you for your review!
Quoted 6 lines
sound/core/pcm_native.c static int snd_pcm_playback_open(struct inode *inode, struct file *file) · line 2877
Quoted 5 lines
struct snd_pcm *pcm; int err = nonseekable_open(inode, file);sound/core/pcm_native.c +1
-2-if (err <0 ) -return err; +
Quoted 6 lines
We don't have to assign err here, right?
Keeping it looks rather confusing.I see a similar pattern in your other patches. Please try to address it and resubmit -- at best, as a v2 series of patches.
I'll update the patches accordingly and send a v2 patch series shortly.
Best regards,
Phuc