public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: usx2y: remove an unneeded check
@ 2013-07-28 20:27 Dan Carpenter
  2013-07-29 11:58 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-07-28 20:27 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, Antonio Ospite, alsa-devel, kernel-janitors

The test here is always true because S[i].urb is an array not a pointer.
Also it's bogus because the intent was to test:
	if (S->urb[i]) {
instead of:
	if (S[i].urb) {

Anway, usb_kill_urb() and usb_free_urb() accept NULL pointers so we can
just remove this.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 1f9bbd5..5a51b18 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -305,11 +305,9 @@ static void usX2Y_unlinkSeq(struct snd_usX2Y_AsyncSeq *S)
 {
 	int	i;
 	for (i = 0; i < URBS_AsyncSeq; ++i) {
-		if (S[i].urb) {
-			usb_kill_urb(S->urb[i]);
-			usb_free_urb(S->urb[i]);
-			S->urb[i] = NULL;
-		}
+		usb_kill_urb(S->urb[i]);
+		usb_free_urb(S->urb[i]);
+		S->urb[i] = NULL;
 	}
 	kfree(S->buffer);
 }

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

* Re: [patch] ALSA: usx2y: remove an unneeded check
  2013-07-28 20:27 [patch] ALSA: usx2y: remove an unneeded check Dan Carpenter
@ 2013-07-29 11:58 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-07-29 11:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jaroslav Kysela, Antonio Ospite, alsa-devel, kernel-janitors

At Sun, 28 Jul 2013 23:27:38 +0300,
Dan Carpenter wrote:
> 
> The test here is always true because S[i].urb is an array not a pointer.
> Also it's bogus because the intent was to test:
> 	if (S->urb[i]) {
> instead of:
> 	if (S[i].urb) {
> 
> Anway, usb_kill_urb() and usb_free_urb() accept NULL pointers so we can
> just remove this.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.


Takashi

> 
> diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
> index 1f9bbd5..5a51b18 100644
> --- a/sound/usb/usx2y/usbusx2y.c
> +++ b/sound/usb/usx2y/usbusx2y.c
> @@ -305,11 +305,9 @@ static void usX2Y_unlinkSeq(struct snd_usX2Y_AsyncSeq *S)
>  {
>  	int	i;
>  	for (i = 0; i < URBS_AsyncSeq; ++i) {
> -		if (S[i].urb) {
> -			usb_kill_urb(S->urb[i]);
> -			usb_free_urb(S->urb[i]);
> -			S->urb[i] = NULL;
> -		}
> +		usb_kill_urb(S->urb[i]);
> +		usb_free_urb(S->urb[i]);
> +		S->urb[i] = NULL;
>  	}
>  	kfree(S->buffer);
>  }
> 

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

end of thread, other threads:[~2013-07-29 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-28 20:27 [patch] ALSA: usx2y: remove an unneeded check Dan Carpenter
2013-07-29 11:58 ` Takashi Iwai

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