w1: Simplify the atribute show
authorzuoqilin <zuoqilin@yulong.com>
Fri, 18 Jun 2021 09:24:18 +0000 (17:24 +0800)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Mon, 8 May 2023 06:14:50 +0000 (08:14 +0200)
There is no necessary to define variable assignment, return directly.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Link: https://lore.kernel.org/r/20210618092418.1424-1-zuoqilin1@163.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/w1/w1.c

index e7e42f9..0da9f52 100644 (file)
@@ -295,17 +295,13 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct devic
 
 static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct device_attribute *attr, char *buf)
 {
-       ssize_t count;
-       count = sprintf(buf, "%d\n", w1_timeout);
-       return count;
+       return sprintf(buf, "%d\n", w1_timeout);
 }
 
 static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
        struct device_attribute *attr, char *buf)
 {
-       ssize_t count;
-       count = sprintf(buf, "%d\n", w1_timeout_us);
-       return count;
+       return sprintf(buf, "%d\n", w1_timeout_us);
 }
 
 static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,