[media] stk-webcam: Delete an unnecessary check before the function call "vfree"
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 3 Feb 2015 17:36:35 +0000 (14:36 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 2 Mar 2015 17:53:27 +0000 (14:53 -0300)
The vfree() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/stkwebcam/stk-webcam.c

index e08fa587332f88028d2f762d8191c589e6403b1b..c21c4c004f9778a50809c27d0cba39ca9596d7f7 100644 (file)
@@ -556,10 +556,8 @@ static int stk_free_sio_buffers(struct stk_camera *dev)
        nbufs = dev->n_sbufs;
        dev->n_sbufs = 0;
        spin_unlock_irqrestore(&dev->spinlock, flags);
-       for (i = 0; i < nbufs; i++) {
-               if (dev->sio_bufs[i].buffer != NULL)
-                       vfree(dev->sio_bufs[i].buffer);
-       }
+       for (i = 0; i < nbufs; i++)
+               vfree(dev->sio_bufs[i].buffer);
        kfree(dev->sio_bufs);
        dev->sio_bufs = NULL;
        return 0;