From 83f56f7cbd070c0d9772221aa61198ef74c96cc4 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 20 Nov 2014 09:26:36 -0300 Subject: [PATCH] [media] USB: Deletion of unnecessary checks before three function calls 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-input.c | 3 +-- drivers/media/usb/em28xx/em28xx-input.c | 3 +-- drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 +- drivers/media/usb/s2255/s2255drv.c | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 63995f97dc65..11a8daec5939 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -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); diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 23f8f6afa2e0..85ac7dd15700 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -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); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c index 7c19ff72e6b3..c8761c71c9d2 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-context.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c @@ -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) { diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index a56a05b0c4e1..e03b155fa5c7 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -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;