The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm: Drop reduntant nonseekable_open() return check
@ 2026-07-02  3:57 phucduc.bui
  2026-07-02  7:24 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: phucduc.bui @ 2026-07-02  3:57 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: cassiogabrielcontato, Cen Zhang, Kees Cook, Mehul Rao,
	Nathan Chancellor, Sebastian Andrzej Siewior, Mark Brown,
	Kuninori Morimoto, eilaimemedsnaimel, linux-sound, linux-kernel,
	bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

nonseekable_open() always returns 0, so the error check is unnecessary.
Remove the dead error handling path.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/core/pcm_native.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 7dc0060617f1..b245b596d95a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -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);
-- 
2.43.0


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

* Re: [PATCH] ALSA: pcm: Drop reduntant nonseekable_open() return check
  2026-07-02  3:57 [PATCH] ALSA: pcm: Drop reduntant nonseekable_open() return check phucduc.bui
@ 2026-07-02  7:24 ` Takashi Iwai
  2026-07-02  8:32   ` Bui Duc Phuc
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2026-07-02  7:24 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato, Cen Zhang,
	Kees Cook, Mehul Rao, Nathan Chancellor,
	Sebastian Andrzej Siewior, Mark Brown, Kuninori Morimoto,
	eilaimemedsnaimel, linux-sound, linux-kernel

On Thu, 02 Jul 2026 05:57:04 +0200,
phucduc.bui@gmail.com wrote:
> 
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> nonseekable_open() always returns 0, so the error check is unnecessary.
> Remove the dead error handling path.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
>  sound/core/pcm_native.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 7dc0060617f1..b245b596d95a 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -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.

>  	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;
> +

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

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

* Re: [PATCH] ALSA: pcm: Drop reduntant nonseekable_open() return check
  2026-07-02  7:24 ` Takashi Iwai
@ 2026-07-02  8:32   ` Bui Duc Phuc
  0 siblings, 0 replies; 3+ messages in thread
From: Bui Duc Phuc @ 2026-07-02  8:32 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato, Cen Zhang,
	Kees Cook, Mehul Rao, Nathan Chancellor,
	Sebastian Andrzej Siewior, Mark Brown, Kuninori Morimoto,
	eilaimemedsnaimel, linux-sound, linux-kernel

Hi Takashi-san,

Thank you for your review!

> >       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.
>
> 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

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

end of thread, other threads:[~2026-07-02  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  3:57 [PATCH] ALSA: pcm: Drop reduntant nonseekable_open() return check phucduc.bui
2026-07-02  7:24 ` Takashi Iwai
2026-07-02  8:32   ` Bui Duc Phuc

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