public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init`
@ 2023-05-04  6:50 Ruliang Lin
  2023-05-04  6:54 ` Daniel Mack
  2023-05-04  7:51 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Ruliang Lin @ 2023-05-04  6:50 UTC (permalink / raw)
  To: Daniel Mack, Jaroslav Kysela, Takashi Iwai, Karsten Wiese
  Cc: hust-os-kernel-patches, Ruliang Lin, Dongliang Mu, Daniel Mack,
	Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

Smatch complains that:
snd_usb_caiaq_input_init() warn: missing error code 'ret'

This patch adds a new case to handle the situation where the 
device does not support any input methods in the 
`snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code 
to indicate that no input methods are supported on the device.

Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support")
Signed-off-by: Ruliang Lin <u202112092@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
The issue is found by static analyzer. The patched code has passed
Smatch checker, but remains untested on real device.
---
 sound/usb/caiaq/input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index 1e2cf2f08eec..84f26dce7f5d 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -804,6 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)
 
 	default:
 		/* no input methods supported on this device */
+		ret = -EINVAL;
 		goto exit_free_idev;
 	}
 
-- 
2.25.1


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

* Re: [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init`
  2023-05-04  6:50 [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` Ruliang Lin
@ 2023-05-04  6:54 ` Daniel Mack
  2023-05-04  7:51 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Mack @ 2023-05-04  6:54 UTC (permalink / raw)
  To: Ruliang Lin, Jaroslav Kysela, Takashi Iwai, Karsten Wiese
  Cc: hust-os-kernel-patches, Dongliang Mu, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel

On 5/4/23 08:50, Ruliang Lin wrote:
> Smatch complains that:
> snd_usb_caiaq_input_init() warn: missing error code 'ret'
> 
> This patch adds a new case to handle the situation where the 
> device does not support any input methods in the 
> `snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code 
> to indicate that no input methods are supported on the device.
> 
> Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support")
> Signed-off-by: Ruliang Lin <u202112092@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>

Acked-by: Daniel Mack <daniel@zonque.org>



> ---
> The issue is found by static analyzer. The patched code has passed
> Smatch checker, but remains untested on real device.
> ---
>  sound/usb/caiaq/input.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
> index 1e2cf2f08eec..84f26dce7f5d 100644
> --- a/sound/usb/caiaq/input.c
> +++ b/sound/usb/caiaq/input.c
> @@ -804,6 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)
>  
>  	default:
>  		/* no input methods supported on this device */
> +		ret = -EINVAL;
>  		goto exit_free_idev;
>  	}
>  


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

* Re: [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init`
  2023-05-04  6:50 [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` Ruliang Lin
  2023-05-04  6:54 ` Daniel Mack
@ 2023-05-04  7:51 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-05-04  7:51 UTC (permalink / raw)
  To: Ruliang Lin
  Cc: Daniel Mack, Jaroslav Kysela, Takashi Iwai, Karsten Wiese,
	hust-os-kernel-patches, Dongliang Mu, Daniel Mack,
	Jaroslav Kysela, alsa-devel, linux-kernel

On Thu, 04 May 2023 08:50:53 +0200,
Ruliang Lin wrote:
> 
> Smatch complains that:
> snd_usb_caiaq_input_init() warn: missing error code 'ret'
> 
> This patch adds a new case to handle the situation where the 
> device does not support any input methods in the 
> `snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code 
> to indicate that no input methods are supported on the device.
> 
> Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support")
> Signed-off-by: Ruliang Lin <u202112092@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
> ---
> The issue is found by static analyzer. The patched code has passed
> Smatch checker, but remains untested on real device.

Thanks, applied.


Takashi

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

end of thread, other threads:[~2023-05-04  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04  6:50 [PATCH] sound: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` Ruliang Lin
2023-05-04  6:54 ` Daniel Mack
2023-05-04  7:51 ` Takashi Iwai

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