[media] USB: Deletion of unnecessary checks before three function calls
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 20 Nov 2014 12:26:36 +0000 (09:26 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 25 Nov 2014 15:31:52 +0000 (13:31 -0200)
GIT_AUTHOR_DATE=1416486805
The functions pvr2_hdw_destroy(), rc_unregister_device() and vfree() perform
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: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/au0828/au0828-input.c
drivers/media/usb/em28xx/em28xx-input.c
drivers/media/usb/pvrusb2/pvrusb2-context.c
drivers/media/usb/s2255/s2255drv.c

index 63995f97dc653276abd5aaaab44e08c3dde0ba69..11a8daec5939f52c0be987d132eba270412dc765 100644 (file)
@@ -363,8 +363,7 @@ void au0828_rc_unregister(struct au0828_dev *dev)
        if (!ir)
                return;
 
-       if (ir->rc)
-               rc_unregister_device(ir->rc);
+       rc_unregister_device(ir->rc);
 
        /* done */
        kfree(ir);
index 23f8f6afa2e061a783ee9fa5c0d244c9c6018dcf..85ac7dd157002a589fddd2c8e688ff72a1ce2ccf 100644 (file)
@@ -841,8 +841,7 @@ static int em28xx_ir_fini(struct em28xx *dev)
        if (!ir)
                goto ref_put;
 
-       if (ir->rc)
-               rc_unregister_device(ir->rc);
+       rc_unregister_device(ir->rc);
 
        kfree(ir->i2c_client);
 
index 7c19ff72e6b3255b2dbacbc32e40b028e4f76140..c8761c71c9d285fae40afb1dbcfba286ef22d531 100644 (file)
@@ -80,7 +80,7 @@ static void pvr2_context_set_notify(struct pvr2_context *mp, int fl)
 static void pvr2_context_destroy(struct pvr2_context *mp)
 {
        pvr2_trace(PVR2_TRACE_CTXT,"pvr2_context %p (destroy)",mp);
-       if (mp->hdw) pvr2_hdw_destroy(mp->hdw);
+       pvr2_hdw_destroy(mp->hdw);
        pvr2_context_set_notify(mp, 0);
        mutex_lock(&pvr2_context_mutex);
        if (mp->exist_next) {
index a56a05b0c4e1e686ef45bbe6127452e60bdc240f..e03b155fa5c75170e0a017743d9afe1cae3bf745 100644 (file)
@@ -1974,8 +1974,7 @@ static int s2255_release_sys_buffers(struct s2255_vc *vc)
 {
        unsigned long i;
        for (i = 0; i < SYS_FRAMES; i++) {
-               if (vc->buffer.frame[i].lpvbits)
-                       vfree(vc->buffer.frame[i].lpvbits);
+               vfree(vc->buffer.frame[i].lpvbits);
                vc->buffer.frame[i].lpvbits = NULL;
        }
        return 0;