• Julia Lawall's avatar
    drivers/staging/vt6656/main_usb.c: Delete unnecessary call to usb_kill_urb · 17fb7616
    Julia Lawall authored
    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: default avatarJulia Lawall <julia@diku.dk>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    17fb7616
main_usb.c 59.4 KB