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: 7563421 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DFF28BEEA4 for ; Thu, 5 Nov 2015 18:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 177BB206EE for ; Thu, 5 Nov 2015 18:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F4FE20783 for ; Thu, 5 Nov 2015 18:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756160AbbKESuL (ORCPT ); Thu, 5 Nov 2015 13:50:11 -0500 Received: from mout.web.de ([212.227.15.3]:49593 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbbKESuI (ORCPT ); Thu, 5 Nov 2015 13:50:08 -0500 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> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall 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 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, 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); } }