leds: Remove uneeded strlen calls
There's no need for the additional call to strlen(), we can directly return the value returned by sprintf(). We now return a length value that doesn't include the final '\0', but user space shouldn't bother about it anyway. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
6af4f55c31
commit
dd8e5a2039
@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
ssize_t ret = 0;
|
||||
|
||||
/* no lock needed for this */
|
||||
led_update_brightness(led_cdev);
|
||||
sprintf(buf, "%u\n", led_cdev->brightness);
|
||||
ret = strlen(buf) + 1;
|
||||
|
||||
return ret;
|
||||
return sprintf(buf, "%u\n", led_cdev->brightness);
|
||||
}
|
||||
|
||||
static ssize_t led_brightness_store(struct device *dev,
|
||||
|
Reference in New Issue
Block a user