From patchwork Fri Nov 21 16:17:26 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: 5356101 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 9DDF9C11AC for ; Fri, 21 Nov 2014 16:18:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01E85201C8 for ; Fri, 21 Nov 2014 16:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 53894201B9 for ; Fri, 21 Nov 2014 16:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758592AbaKUQSO (ORCPT ); Fri, 21 Nov 2014 11:18:14 -0500 Received: from mout.web.de ([212.227.17.12]:62578 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755412AbaKUQSN (ORCPT ); Fri, 21 Nov 2014 11:18:13 -0500 Received: from [192.168.1.2] ([78.49.23.187]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M0Qkb-1Y5wqH0aTt-00ucdn; Fri, 21 Nov 2014 17:17:40 +0100 Message-ID: <546F6596.6010103@users.sourceforge.net> Date: Fri, 21 Nov 2014 17:17:26 +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: Eduardo Valentin , Kukjin Kim , Zhang Rui , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH v2] thermal: Exynos: 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> <546F1017.5080403@users.sourceforge.net> In-Reply-To: X-Provags-ID: V03:K0:BLGjItj4QDY9OaFEgeTKA0wq5X1NaKf8YutSUgiO5PxPKrVpR0J jbzkC9LEK5a3agkWZHFuUqzcVQGOh5f2oii93onS7yuKI4PH8DqC1j/jgBQ7Ic+h3rIEii1 XnuTBPcvLf5SWWGeYjwcZ4CABfO974px143+orPXYNu55ir56EawBW/O8KjZCqncJg9nTXU CT18onsvgVO73g/vnWqCQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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: Fri, 21 Nov 2014 17:11:49 +0100 The functions cpufreq_cooling_unregister() and thermal_zone_device_unregister() 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/thermal/samsung/exynos_thermal_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c index 3f5ad25..b6be572 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.c +++ b/drivers/thermal/samsung/exynos_thermal_common.c @@ -417,13 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) th_zone = sensor_conf->pzone_data; - if (th_zone->therm_dev) - thermal_zone_device_unregister(th_zone->therm_dev); + thermal_zone_device_unregister(th_zone->therm_dev); - for (i = 0; i < th_zone->cool_dev_size; i++) { - if (th_zone->cool_dev[i]) - cpufreq_cooling_unregister(th_zone->cool_dev[i]); - } + for (i = 0; i < th_zone->cool_dev_size; ++i) + cpufreq_cooling_unregister(th_zone->cool_dev[i]); dev_info(sensor_conf->dev, "Exynos: Kernel Thermal management unregistered\n");