blob: 73bc9d5402be77f01f99c2b8cee47ce75031ee24 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 7566655c9e659e890f44784a6403de98ad77ae5b Mon Sep 17 00:00:00 2001
2From: Colin Ian King <colin.king@canonical.com>
3Date: Tue, 19 May 2020 16:45:53 +0100
4Subject: [PATCH] w1_therm: remove redundant assignments to variable
5 ret
6
7commit f37d13d52c0560bd2bac40b22466af538e61a5ce upstream.
8
9The variable ret is being initialized with a value that is never read
10and it is being updated later with a new value. The initialization
11is redundant and can be removed.
12
13Addresses-Coverity: ("Unused value")
14Signed-off-by: Colin Ian King <colin.king@canonical.com>
15Link: https://lore.kernel.org/r/20200519154553.873413-1-colin.king@canonical.com
16Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17---
18 drivers/w1/slaves/w1_therm.c | 8 ++++----
19 1 file changed, 4 insertions(+), 4 deletions(-)
20
21--- a/drivers/w1/slaves/w1_therm.c
22+++ b/drivers/w1/slaves/w1_therm.c
23@@ -505,7 +505,7 @@ static inline int w1_DS18S20_write_data(
24
25 static inline int w1_DS18B20_set_resolution(struct w1_slave *sl, int val)
26 {
27- int ret = -ENODEV;
28+ int ret;
29 u8 new_config_register[3]; /* array of data to be written */
30 struct therm_info info;
31
32@@ -538,7 +538,7 @@ static inline int w1_DS18B20_set_resolut
33
34 static inline int w1_DS18B20_get_resolution(struct w1_slave *sl)
35 {
36- int ret = -ENODEV;
37+ int ret;
38 u8 config_register;
39 struct therm_info info;
40
41@@ -1499,7 +1499,7 @@ static ssize_t alarms_show(struct device
42 struct device_attribute *attr, char *buf)
43 {
44 struct w1_slave *sl = dev_to_w1_slave(device);
45- int ret = -ENODEV;
46+ int ret;
47 s8 th = 0, tl = 0;
48 struct therm_info scratchpad;
49
50@@ -1523,7 +1523,7 @@ static ssize_t alarms_store(struct devic
51 struct w1_slave *sl = dev_to_w1_slave(device);
52 struct therm_info info;
53 u8 new_config_register[3]; /* array of data to be written */
54- int temp, ret = -EINVAL;
55+ int temp, ret;
56 char *token = NULL;
57 s8 tl, th, tt; /* 1 byte per value + temp ring order */
58 char *p_args, *orig;