Skip to contentSkip to conversation

ALSA: usx2y: remove an unneeded check

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 28, 2013 – Jul 29, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usx2y: remove an unneeded check

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.

sound/usb/usx2y/usbusx2y.c +3 -5
index 1f9bbd5..5a51b18 100644
@@ -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);
 }
Applied
#1 lore raw

At Sun, 28 Jul 2013 23:27:38 +0300,

Quoted 11 lines · Dan Carpenter

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.

Thanks, applied.

Takashi

Quoted 21 lines
sound/usb/usx2y/usbusx2y.c +3 -5
index 1f9bbd5..5a51b18 100644
@@ -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);
 }