The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ALSA: control: Drop redundant stream_open() return check
@ 2026-07-02  4:46 phucduc.bui
  2026-07-02  9:24 ` Cezary Rojewski
  0 siblings, 1 reply; 3+ messages in thread
From: phucduc.bui @ 2026-07-02  4:46 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: cassiogabrielcontato, Cezary Rojewski, Kees Cook, Mark Brown,
	linux-sound, linux-kernel, bui duc phuc

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

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@gmail.com>
---
 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;
 
 	card = snd_lookup_minor_data(iminor(inode), SNDRV_DEVICE_TYPE_CONTROL);
 	if (!card) {
-- 
2.43.0


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

* Re: [PATCH] ALSA: control: Drop redundant stream_open() return check
  2026-07-02  4:46 [PATCH] ALSA: control: Drop redundant stream_open() return check phucduc.bui
@ 2026-07-02  9:24 ` Cezary Rojewski
  2026-07-02  9:36   ` Bui Duc Phuc
  0 siblings, 1 reply; 3+ messages in thread
From: Cezary Rojewski @ 2026-07-02  9:24 UTC (permalink / raw)
  To: phucduc.bui
  Cc: cassiogabrielcontato, Kees Cook, Mark Brown, linux-sound,
	linux-kernel, Jaroslav Kysela, Takashi Iwai

On 7/2/2026 6:46 AM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> 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@gmail.com>
> ---
>   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) {


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

* Re: [PATCH] ALSA: control: Drop redundant stream_open() return check
  2026-07-02  9:24 ` Cezary Rojewski
@ 2026-07-02  9:36   ` Bui Duc Phuc
  0 siblings, 0 replies; 3+ messages in thread
From: Bui Duc Phuc @ 2026-07-02  9:36 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: cassiogabrielcontato, Kees Cook, Mark Brown, linux-sound,
	linux-kernel, Jaroslav Kysela, Takashi Iwai

Hi Cezary,

Thanks for the review!

>
> 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/20260702084445.519669-1-phucduc.bui@gmail.com/

Your review and Takashi-san's pointed out the same issue.
Thanks to both of you!

Best,
Bui Duc Phuc

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  4:46 [PATCH] ALSA: control: Drop redundant stream_open() return check phucduc.bui
2026-07-02  9:24 ` Cezary Rojewski
2026-07-02  9:36   ` 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