Skip to contentSkip to conversation

fujitsu-laptop: simplify show_brightness_changed()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 26, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fujitsu-laptop: simplify show_brightness_changed()

->brightness_changed is either 0 or 1, and never a negative. We can just remove this code.

drivers/platform/x86/fujitsu-laptop.c +1 -8
index 2a9afa2..aa5ee98 100644
@@ -444,14 +444,7 @@ static ssize_t
 show_brightness_changed(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-
-	int ret;
-
-	ret = fujitsu->brightness_changed;
-	if (ret < 0)
-		return ret;
-
-	return sprintf(buf, "%i\n", ret);
+	return sprintf(buf, "%i\n", fujitsu->brightness_changed);
 }
 
 static ssize_t show_lcd_level(struct device *dev,
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

->brightness_changed is either 0 or 1, and never a negative. We can just remove this code.

I agree. Thanks for spotting this.

Quoted 20 lines
drivers/platform/x86/fujitsu-laptop.c +1 -8
index 2a9afa2..aa5ee98 100644
@@ -444,14 +444,7 @@ static ssize_t
 show_brightness_changed(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-
-	int ret;
-
-	ret = fujitsu->brightness_changed;
-	if (ret < 0)
-		return ret;
-
-	return sprintf(buf, "%i\n", ret);
+	return sprintf(buf, "%i\n", fujitsu->brightness_changed);
 }
 
 static ssize_t show_lcd_level(struct device *dev,