From patchwork Thu Nov 20 12:33:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5347721 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C90D99F2F1 for ; Thu, 20 Nov 2014 12:33:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E950320225 for ; Thu, 20 Nov 2014 12:33:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1571C20220 for ; Thu, 20 Nov 2014 12:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755212AbaKTMdp (ORCPT ); Thu, 20 Nov 2014 07:33:45 -0500 Received: from mout.web.de ([212.227.17.12]:58331 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbaKTMdo (ORCPT ); Thu, 20 Nov 2014 07:33:44 -0500 Received: from [192.168.1.2] ([78.48.101.99]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M1oGM-1Y7AIS0Xog-00tjtq; Thu, 20 Nov 2014 13:33:38 +0100 Message-ID: <546DDF95.5090300@users.sourceforge.net> Date: Thu, 20 Nov 2014 13:33:25 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab , Mike Isely , linux-media@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/1] [media] USB: Deletion of unnecessary checks before three function calls References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:aR99qqUh4ZUcCk9rmRVPvCnbQKoIPd5B8d6IiM83AOoaI1eIIaK nYU3T/b+gF6anCNfL8wGueAGV4ZrRQUHGts2jEQqhCHqAYqEHU1aJBYW47HRR4bdmcXC68c eunKyY6DvCdNZrxYtdo35P55QZB9fB5VNdGzeV/Y4iV6ggKSigItyTlSxQS4i4CVL0AuxQ2 uHQ9GiQP4Cfa1ebReM3YA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 20 Nov 2014 13:26:36 +0100 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 --- 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 fd0d3a90..3357141 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -353,8 +353,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 ed843bd..67a22f4 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -838,8 +838,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); /* done */ kfree(ir); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c index 7c19ff7..c8761c7 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 2c90186..3cab886 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1976,8 +1976,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;