From patchwork Thu Nov 5 18:49:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7563441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE54DBEEA4 for ; Thu, 5 Nov 2015 18:51:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 059C920761 for ; Thu, 5 Nov 2015 18:51:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC3A920783 for ; Thu, 5 Nov 2015 18:51:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZuPbt-0004ms-IP; Thu, 05 Nov 2015 18:50:09 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZuPbp-0003xj-RC for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2015 18:50:06 +0000 Received: from [192.168.1.2] ([78.49.111.82]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MhlT9-1a6sLE1yl9-00MxGI; Thu, 05 Nov 2015 19:49:35 +0100 Subject: [PATCH 1/2] [media] c8sectpfe: Delete unnecessary checks before two function calls To: Mauro Carvalho Chehab , Maxime Coquelin , Patrice Chotard , Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, kernel@stlinux.com 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> <563BA3CC.4040709@users.sourceforge.net> From: SF Markus Elfring Message-ID: <563BA4B0.5090708@users.sourceforge.net> Date: Thu, 5 Nov 2015 19:49:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563BA3CC.4040709@users.sourceforge.net> X-Provags-ID: V03:K0:ZyhzOJLXAKF9OGwH//nzwy7LcCfvHZPZGJvgishgdNQVSqN0AgR B6Css4vSEtGFRxFZ+ySGOjWH87iBNHwMyCdT8J48nanzh10DKGdUrhHcsLm8LQ5X0kr7hC8 w2McFuM82Hskhcv69PsLmit8ravSx+RtGzyF0vq0WxVIzC3ahkyEwa9vUfvpmiqWFf554gR gOM9DFx6YvGc0uUkYMy/Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:cZdmyKWX+Ao=:9p+qCK+Du/Q9PyJKumyf1I qdLp3tqw30dFtkPkaV49IoUIQRy1EvWENVwoYq8pVhduY0N+ko39H/iVkQicikPNcKIsxq4w2 vsGy2mt1CVhTK7rHss9Pt9LJ1Wfk70CvEQt8ua5JNRXQAq+isbQ2MeidkszPYl6vsjK5Gts16 OkAXjWMEMkDGD4gXZ3aVEWdVI8u+2HNowR1kBYsFrdwKSuie1M9fcLX+iauDgQ5X9KiT193OB 8oN/2k9d3XagRGacEuFeEt87mFRD9TWx20b2X82+lsTdByWW4Xdylxu8JfIB3nrBOx22taFR7 iB77ORbCnuFC9gQUO3NSexzSaMWCZM/TFJ44SZ7bK/OkhY2UqYfBAMfV0/VCTJNw766Di0c7+ ANOSru8mCSaROqCAuUXpxGE96jbRkEAga1zwclpMxGC8/CKv03pV5R6gfsAwWzf8bmsezGyda roEH4MRHEe4MlK5DLYzsQsEhmXz8sAx1y4CwICPjUiCJmFuEe9bSRJJtVZB78B4BkuJaWIHQr ZptUEHMdO3bMu6UsQwRgRgrDbzzqe6fC3nKI9O2BjEI+pAvIZAYzguvTAPTQj5gPa5oP5q7Gd BJDQ9X446/ag6KEj3Qax0QmN3tYYw6BSAaB9+tOZ5riG1DtVq7aCQVumxkJFl4Pjy5PauUPpb rkagnXfpODWt/xNNesJlxp2kX9lr0umtqSJYnANv+YAU68WKuf0LkMyV8jGRG7Q4RT/5UFXNI xyEYarDqwjQUDDqGmFkGWdne3aITcrYZdG1EefItN/YYLcbPtj+aD2AwqqrPpd7i+/yMDjOqE VtIXArx X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151105_105006_278280_5B160D06 X-CRM114-Status: GOOD ( 11.57 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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, 5 Nov 2015 18:55:19 +0100 The functions i2c_put_adapter() and module_put() test whether their argument is NULL and then return immediately. Thus the tests around their calls are not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c index 95223ab..07fd6d9 100644 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c @@ -214,12 +214,11 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe, dvb_frontend_detach(tsin->frontend); } - if (tsin && tsin->i2c_adapter) + if (tsin) i2c_put_adapter(tsin->i2c_adapter); if (tsin && tsin->i2c_client) { - if (tsin->i2c_client->dev.driver->owner) - module_put(tsin->i2c_client->dev.driver->owner); + module_put(tsin->i2c_client->dev.driver->owner); i2c_unregister_device(tsin->i2c_client); } }