From patchwork Thu Nov 20 12:08:46 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: 5347691 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D501FC11AC for ; Thu, 20 Nov 2014 12:09:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05C6720221 for ; Thu, 20 Nov 2014 12:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 259AB2021F for ; Thu, 20 Nov 2014 12:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756011AbaKTMJJ (ORCPT ); Thu, 20 Nov 2014 07:09:09 -0500 Received: from mout.web.de ([212.227.15.3]:55087 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbaKTMJE (ORCPT ); Thu, 20 Nov 2014 07:09:04 -0500 Received: from [192.168.1.2] ([78.48.101.99]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MFNpM-1Xlwtz2glw-00EQqP; Thu, 20 Nov 2014 13:08:59 +0100 Message-ID: <546DD9CE.60008@users.sourceforge.net> Date: Thu, 20 Nov 2014 13:08:46 +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 , linux-media@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/1] [media] rc: Deletion of unnecessary checks before two 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:byZj8WC+eh9+XVwhKwz79m4MteVdYVbkwqf0TDFYlBQFSlAJDvt j6f1oaajqbqdhxmk8d6nH2XqM4TGeCYWmNqG4jOxofFnvbKzRa5mb/kRL8TsJH1c16xPfwr O/a0GGylW1rurEdZnH+mXrVY/Xw23hakf12mf22sjZBtCtQdOmB2TMUKpvaLFiPKt0irtgE qxjPB26iDmHa+BAzdeLuA== 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:01:32 +0100 The functions input_free_device() and rc_close() test whether their argument is NULL and then return immediately. 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/rc/lirc_dev.c | 3 +-- drivers/media/rc/rc-main.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index dc5cbff..5c232e6 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -518,8 +518,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) WARN_ON(mutex_lock_killable(&lirc_dev_lock)); - if (ir->d.rdev) - rc_close(ir->d.rdev); + rc_close(ir->d.rdev); ir->open--; if (ir->attached) { diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 8d3b74c..66df9fb 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1298,8 +1298,7 @@ void rc_free_device(struct rc_dev *dev) if (!dev) return; - if (dev->input_dev) - input_free_device(dev->input_dev); + input_free_device(dev->input_dev); put_device(&dev->dev);