Skip to contentSkip to conversation

w1_therm: remove redundant assignments to variable ret

PATCH New Colin King 1 participant 1 message May 19, 2020

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 w1_therm: remove redundant assignments to variable ret

From: Colin Ian King <[email protected]>

The variable ret is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/w1/slaves/w1_therm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/w1/slaves/w1_therm.c +4 -4
index cc4b88056b33..d5f062c05c9d 100644
@@ -505,7 +505,7 @@ static inline int w1_DS18S20_write_data(struct w1_slave *sl,
 
 static inline int w1_DS18B20_set_resolution(struct w1_slave *sl, int val)
 {
-	int ret = -ENODEV;
+	int ret;
 	u8 new_config_register[3];	/* array of data to be written */
 	struct therm_info info;
 
@@ -538,7 +538,7 @@ static inline int w1_DS18B20_set_resolution(struct w1_slave *sl, int val)
 
 static inline int w1_DS18B20_get_resolution(struct w1_slave *sl)
 {
-	int ret = -ENODEV;
+	int ret;
 	u8 config_register;
 	struct therm_info info;
 
@@ -1499,7 +1499,7 @@ static ssize_t alarms_show(struct device *device,
 	struct device_attribute *attr, char *buf)
 {
 	struct w1_slave *sl = dev_to_w1_slave(device);
-	int ret = -ENODEV;
+	int ret;
 	s8 th = 0, tl = 0;
 	struct therm_info scratchpad;
 
@@ -1523,7 +1523,7 @@ static ssize_t alarms_store(struct device *device,
 	struct w1_slave *sl = dev_to_w1_slave(device);
 	struct therm_info info;
 	u8 new_config_register[3];	/* array of data to be written */
-	int temp, ret = -EINVAL;
+	int temp, ret;
 	char *token = NULL;
 	s8 tl, th, tt;	/* 1 byte per value + temp ring order */
 	char *p_args = kmalloc(size, GFP_KERNEL);
Signature · 1 line
2.25.1