b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From 7566655c9e659e890f44784a6403de98ad77ae5b Mon Sep 17 00:00:00 2001 |
| 2 | From: Colin Ian King <colin.king@canonical.com> |
| 3 | Date: Tue, 19 May 2020 16:45:53 +0100 |
| 4 | Subject: [PATCH] w1_therm: remove redundant assignments to variable |
| 5 | ret |
| 6 | |
| 7 | commit f37d13d52c0560bd2bac40b22466af538e61a5ce upstream. |
| 8 | |
| 9 | The variable ret is being initialized with a value that is never read |
| 10 | and it is being updated later with a new value. The initialization |
| 11 | is redundant and can be removed. |
| 12 | |
| 13 | Addresses-Coverity: ("Unused value") |
| 14 | Signed-off-by: Colin Ian King <colin.king@canonical.com> |
| 15 | Link: https://lore.kernel.org/r/20200519154553.873413-1-colin.king@canonical.com |
| 16 | Signed-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; |