Skip to contentSkip to conversation

thermal: sysfs: Fix indentation in create_s32_tzp_attr()

PATCH Applied Thorsten Blum 2 participants 2 messages Oct 3 – Oct 26 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: sysfs: Fix indentation in create_s32_tzp_attr()

Indent the show callback consistently with the store callback and use an early return if the thermal zone parameters are not available.

---
 drivers/thermal/thermal_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/thermal_sysfs.c +4 -4
index 96fe5d591a0a..47daba943a76 100644
@@ -287,12 +287,12 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr,
 	name##_show(struct device *dev, struct device_attribute *devattr, \
 		char *buf)						\
 	{								\
-	struct thermal_zone_device *tz = to_thermal_zone(dev);		\
+		struct thermal_zone_device *tz = to_thermal_zone(dev);	\
+									\
+		if (!tz->tzp)						\
+			return -EIO;					\
 									\
-	if (tz->tzp)							\
 		return sysfs_emit(buf, "%d\n", tz->tzp->name);		\
-	else								\
-		return -EIO;						\
 	}								\
 									\
 	static ssize_t							\
maintainer Applied
#1 lore raw
Quoted 20 lines · Thorsten Blum

Indent the show callback consistently with the store callback and use an early return if the thermal zone parameters are not available.

---
 drivers/thermal/thermal_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/thermal_sysfs.c +2 -1
index 96fe5d591a0a..47daba943a76 100644
@@ -287,12 +287,12 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr,
        name##_show(struct device *dev, struct device_attribute *devattr, \
                char *buf)                                              \
        {                                                               \
-       struct thermal_zone_device *tz = to_thermal_zone(dev);          \
+               struct thermal_zone_device *tz = to_thermal_zone(dev);  \
+                                                                       \

drivers/thermal/thermal_sysfs.c sustainable_power_store(struct device *dev, struct device_attribute *devattr, · line 298

Quoted 10 lines
drivers/thermal/thermal_sysfs.c +2 -3
+               if (!tz->tzp)                                           \
+                       return -EIO;                                    \
                                                                        \
-       if (tz->tzp)                                                    \
                return sysfs_emit(buf, "%d\n", tz->tzp->name);          \
-       else                                                            \
-               return -EIO;                                            \
        }                                                               \
                                                                        \
        static ssize_t                                                  \

Applied as 7.4-rc material, thanks!