aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/leds/led-class.c5
-rw-r--r--drivers/leds/ledtrig-timer.c8
2 files changed, 3 insertions, 10 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ee74ee7b2acc..8a7d138ec503 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev,
34 struct device_attribute *attr, char *buf) 34 struct device_attribute *attr, char *buf)
35{ 35{
36 struct led_classdev *led_cdev = dev_get_drvdata(dev); 36 struct led_classdev *led_cdev = dev_get_drvdata(dev);
37 ssize_t ret = 0;
38 37
39 /* no lock needed for this */ 38 /* no lock needed for this */
40 led_update_brightness(led_cdev); 39 led_update_brightness(led_cdev);
41 sprintf(buf, "%u\n", led_cdev->brightness);
42 ret = strlen(buf) + 1;
43 40
44 return ret; 41 return sprintf(buf, "%u\n", led_cdev->brightness);
45} 42}
46 43
47static ssize_t led_brightness_store(struct device *dev, 44static ssize_t led_brightness_store(struct device *dev,
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index 5c99f4f0c692..db681962d7bb 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -70,9 +70,7 @@ static ssize_t led_delay_on_show(struct device *dev,
70 struct led_classdev *led_cdev = dev_get_drvdata(dev); 70 struct led_classdev *led_cdev = dev_get_drvdata(dev);
71 struct timer_trig_data *timer_data = led_cdev->trigger_data; 71 struct timer_trig_data *timer_data = led_cdev->trigger_data;
72 72
73 sprintf(buf, "%lu\n", timer_data->delay_on); 73 return sprintf(buf, "%lu\n", timer_data->delay_on);
74
75 return strlen(buf) + 1;
76} 74}
77 75
78static ssize_t led_delay_on_store(struct device *dev, 76static ssize_t led_delay_on_store(struct device *dev,
@@ -116,9 +114,7 @@ static ssize_t led_delay_off_show(struct device *dev,
116 struct led_classdev *led_cdev = dev_get_drvdata(dev); 114 struct led_classdev *led_cdev = dev_get_drvdata(dev);
117 struct timer_trig_data *timer_data = led_cdev->trigger_data; 115 struct timer_trig_data *timer_data = led_cdev->trigger_data;
118 116
119 sprintf(buf, "%lu\n", timer_data->delay_off); 117 return sprintf(buf, "%lu\n", timer_data->delay_off);
120
121 return strlen(buf) + 1;
122} 118}
123 119
124static ssize_t led_delay_off_store(struct device *dev, 120static ssize_t led_delay_off_store(struct device *dev,