Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/staging/vt6656/main_usb.c: Delete unnecessary call to usb_kill_urb

Since in each case nothing has been done with the recently allocated urb,
it is not necessary to kill it before freeing it.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression urb;
statement S;
position p1,p2;
@@

urb = usb_alloc_urb@p1(...);
... when != urb
if (urb == NULL) S
... when != urb
usb_kill_urb@p2(urb);

@other exists@
position r.p1,r.p2;
@@

... when != usb_alloc_urb@p1(...)
usb_kill_urb@p2(...);

@depends on !other exists@
expression urb;
position r.p1,r.p2;
@@

urb = usb_alloc_urb@p1(...);
...
(
-usb_kill_urb@p2(urb);
+usb_free_urb(urb);
... when != urb
|
-usb_kill_urb@p2(urb);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Julia Lawall and committed by
Greg Kroah-Hartman
17fb7616 7ed2911c

-3
-3
drivers/staging/vt6656/main_usb.c
··· 955 955 pDevice->pInterruptURB = usb_alloc_urb(0, GFP_ATOMIC); 956 956 if (pDevice->pInterruptURB == NULL) { 957 957 DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int urb\n"); 958 - usb_kill_urb(pDevice->pControlURB); 959 958 usb_free_urb(pDevice->pControlURB); 960 959 goto free_rx_tx; 961 960 } ··· 962 963 pDevice->intBuf.pDataBuf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL); 963 964 if (pDevice->intBuf.pDataBuf == NULL) { 964 965 DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc int buf\n"); 965 - usb_kill_urb(pDevice->pControlURB); 966 - usb_kill_urb(pDevice->pInterruptURB); 967 966 usb_free_urb(pDevice->pControlURB); 968 967 usb_free_urb(pDevice->pInterruptURB); 969 968 goto free_rx_tx;