usb-misc: sisusbvga: Remove null test before calls to kfree()
authorPeter Senna Tschudin <peter.senna@gmail.com>
Fri, 15 Jan 2016 17:41:32 +0000 (18:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jan 2016 05:04:54 +0000 (21:04 -0800)
This patch removes null test before calls to kfree() as kfree() can
handle null pointers safely.

Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/sisusbvga/sisusb.c

index 40f360ab406d8d5f0dc748224ba2d4e655d2b5e4..bea6d88f769a746a3004f543c2443ca1415fa106 100644 (file)
@@ -76,15 +76,11 @@ static void sisusb_free_buffers(struct sisusb_usb_data *sisusb)
        int i;
 
        for (i = 0; i < NUMOBUFS; i++) {
-               if (sisusb->obuf[i]) {
-                       kfree(sisusb->obuf[i]);
-                       sisusb->obuf[i] = NULL;
-               }
-       }
-       if (sisusb->ibuf) {
-               kfree(sisusb->ibuf);
-               sisusb->ibuf = NULL;
+               kfree(sisusb->obuf[i]);
+               sisusb->obuf[i] = NULL;
        }
+       kfree(sisusb->ibuf);
+       sisusb->ibuf = NULL;
 }
 
 static void sisusb_free_urbs(struct sisusb_usb_data *sisusb)