From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D17A2C352BE for ; Tue, 14 Apr 2020 18:03:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA2132076B for ; Tue, 14 Apr 2020 18:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503189AbgDNSB1 (ORCPT ); Tue, 14 Apr 2020 14:01:27 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46710 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503178AbgDNSBW (ORCPT ); Tue, 14 Apr 2020 14:01:22 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id C384B2A1BDE From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org Cc: Zhang Rui , "Rafael J . Wysocki" , Len Brown , Jiri Pirko , Ido Schimmel , "David S . Miller" , Peter Kaestle , Darren Hart , Andy Shevchenko , Support Opensource , Daniel Lezcano , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, Andrzej Pietrasiewicz Subject: [RFC v2 2/9] thermal: Eliminate an always-false condition Date: Tue, 14 Apr 2020 20:00:58 +0200 Message-Id: <20200414180105.20042-3-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414180105.20042-1-andrzej.p@collabora.com> References: <2bc5a902-acde-526a-11a5-2357d899916c@linaro.org> <20200414180105.20042-1-andrzej.p@collabora.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org This driver provides a non-NULL "devdata" argument for thermal_zone_device_register(). Thermal core never sets it to NULL afterwards, so checking for its being NULL in this driver makes no sense. Signed-off-by: Andrzej Pietrasiewicz --- drivers/acpi/thermal.c | 6 ------ drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 6 ------ 2 files changed, 12 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 19067a5e5293..328b479ce7f6 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -531,9 +531,6 @@ static int thermal_get_mode(struct thermal_zone_device *thermal, { struct acpi_thermal *tz = thermal->devdata; - if (!tz) - return -EINVAL; - *mode = tz->tz_enabled ? THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED; @@ -546,9 +543,6 @@ static int thermal_set_mode(struct thermal_zone_device *thermal, struct acpi_thermal *tz = thermal->devdata; int enable; - if (!tz) - return -EINVAL; - /* * enable/disable thermal management from ACPI thermal driver */ diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index e802922a13cf..fbb59dd09481 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -235,9 +235,6 @@ static int int3400_thermal_get_mode(struct thermal_zone_device *thermal, { struct int3400_thermal_priv *priv = thermal->devdata; - if (!priv) - return -EINVAL; - *mode = priv->mode; return 0; @@ -250,9 +247,6 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, bool enable; int result = 0; - if (!priv) - return -EINVAL; - if (mode == THERMAL_DEVICE_ENABLED) enable = true; else if (mode == THERMAL_DEVICE_DISABLED) -- 2.17.1