linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA:usb-audio:check urb before kill it
@ 2020-12-27 13:04 Defang Bo
  2020-12-29  8:25 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Defang Bo @ 2020-12-27 13:04 UTC (permalink / raw)
  To: perex, tiwai; +Cc: tom.ty89, kai.heng.feng, alsa-devel, linux-kernel, Defang Bo

Similar to commit<124751d5e>, there should be a check for urb before kill it.

Signed-off-by: Defang Bo <bodefang@126.com>
---
 sound/usb/mixer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 81e987e..0223ef3 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3589,8 +3589,10 @@ void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
 /* stop any bus activity of a mixer */
 static void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer)
 {
-	usb_kill_urb(mixer->urb);
-	usb_kill_urb(mixer->rc_urb);
+	if (mixer->urb)
+		usb_kill_urb(mixer->urb);
+	if (mixer->rc_urb)
+		usb_kill_urb(mixer->rc_urb);
 }
 
 static int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
-- 
2.7.4


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

* Re: [PATCH] ALSA:usb-audio:check urb before kill it
  2020-12-27 13:04 [PATCH] ALSA:usb-audio:check urb before kill it Defang Bo
@ 2020-12-29  8:25 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2020-12-29  8:25 UTC (permalink / raw)
  To: Defang Bo; +Cc: perex, tiwai, tom.ty89, kai.heng.feng, alsa-devel, linux-kernel

On Sun, 27 Dec 2020 14:04:59 +0100,
Defang Bo wrote:
> 
> Similar to commit<124751d5e>, there should be a check for urb before kill it.
> 
> Signed-off-by: Defang Bo <bodefang@126.com>

usb_kill_urb() accepts the NULL urb pointer, so the NULL check in the
caller side is basically superfluous.


thanks,

Takashi

> ---
>  sound/usb/mixer.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index 81e987e..0223ef3 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -3589,8 +3589,10 @@ void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
>  /* stop any bus activity of a mixer */
>  static void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer)
>  {
> -	usb_kill_urb(mixer->urb);
> -	usb_kill_urb(mixer->rc_urb);
> +	if (mixer->urb)
> +		usb_kill_urb(mixer->urb);
> +	if (mixer->rc_urb)
> +		usb_kill_urb(mixer->rc_urb);
>  }
>  
>  static int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2020-12-29  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 13:04 [PATCH] ALSA:usb-audio:check urb before kill it Defang Bo
2020-12-29  8:25 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).