diff mbox series

[RFC,v2,2/9] thermal: Eliminate an always-false condition

Message ID 20200414180105.20042-3-andrzej.p@collabora.com (mailing list archive)
State New, archived
Headers show
Series [RFC,v2,1/9] thermal: int3400_thermal: Statically initialize .get_mode()/.set_mode() ops | expand

Commit Message

Andrzej Pietrasiewicz April 14, 2020, 6 p.m. UTC
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 <andrzej.p@collabora.com>
---
 drivers/acpi/thermal.c                                  | 6 ------
 drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 6 ------
 2 files changed, 12 deletions(-)
diff mbox series

Patch

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)