[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202409122210.audc5WGS-lkp@intel.com>
Date: Fri, 13 Sep 2024 00:36:02 +0800
From: kernel test robot <lkp@...el.com>
To: Patryk Biel <pbiel7@...il.com>, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
Patryk Biel <pbiel7@...il.com>
Subject: Re: [PATCH] hwmon: Conditionally clear individual status bits for
pmbus rev >= 1.2
Hi Patryk,
kernel test robot noticed the following build warnings:
[auto build test WARNING on c763c43396883456ef57e5e78b64d3c259c4babc]
url: https://github.com/intel-lab-lkp/linux/commits/Patryk-Biel/hwmon-Conditionally-clear-individual-status-bits-for-pmbus-rev-1-2/20240909-173838
base: c763c43396883456ef57e5e78b64d3c259c4babc
patch link: https://lore.kernel.org/r/20240909-pmbus-status-reg-clearing-v1-1-f1c0d68c6408%40gmail.com
patch subject: [PATCH] hwmon: Conditionally clear individual status bits for pmbus rev >= 1.2
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240912/202409122210.audc5WGS-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240912/202409122210.audc5WGS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409122210.audc5WGS-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/hwmon/pmbus/pmbus_core.c:1100:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
1100 | if (data->revision >= PMBUS_REV_12)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:1105:7: note: uninitialized use occurs here
1105 | if (ret)
| ^~~
drivers/hwmon/pmbus/pmbus_core.c:1100:3: note: remove the 'if' if its condition is always true
1100 | if (data->revision >= PMBUS_REV_12)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1101 | ret = _pmbus_write_byte_data(client, page, reg, regval);
| ~
1102 | else
| ~~~~
1103 | pmbus_clear_fault_page(client, page);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:1083:9: note: initialize the variable 'ret' to silence this warning
1083 | int ret, status;
| ^
| = 0
1 warning generated.
vim +1100 drivers/hwmon/pmbus/pmbus_core.c
1050
1051 /*
1052 * Return boolean calculated from converted data.
1053 * <index> defines a status register index and mask.
1054 * The mask is in the lower 8 bits, the register index is in bits 8..23.
1055 *
1056 * The associated pmbus_boolean structure contains optional pointers to two
1057 * sensor attributes. If specified, those attributes are compared against each
1058 * other to determine if a limit has been exceeded.
1059 *
1060 * If the sensor attribute pointers are NULL, the function returns true if
1061 * (status[reg] & mask) is true.
1062 *
1063 * If sensor attribute pointers are provided, a comparison against a specified
1064 * limit has to be performed to determine the boolean result.
1065 * In this case, the function returns true if v1 >= v2 (where v1 and v2 are
1066 * sensor values referenced by sensor attribute pointers s1 and s2).
1067 *
1068 * To determine if an object exceeds upper limits, specify <s1,s2> = <v,limit>.
1069 * To determine if an object exceeds lower limits, specify <s1,s2> = <limit,v>.
1070 *
1071 * If a negative value is stored in any of the referenced registers, this value
1072 * reflects an error code which will be returned.
1073 */
1074 static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b,
1075 int index)
1076 {
1077 struct pmbus_data *data = i2c_get_clientdata(client);
1078 struct pmbus_sensor *s1 = b->s1;
1079 struct pmbus_sensor *s2 = b->s2;
1080 u16 mask = pb_index_to_mask(index);
1081 u8 page = pb_index_to_page(index);
1082 u16 reg = pb_index_to_reg(index);
1083 int ret, status;
1084 u16 regval;
1085
1086 mutex_lock(&data->update_lock);
1087 status = pmbus_get_status(client, page, reg);
1088 if (status < 0) {
1089 ret = status;
1090 goto unlock;
1091 }
1092
1093 if (s1)
1094 pmbus_update_sensor_data(client, s1);
1095 if (s2)
1096 pmbus_update_sensor_data(client, s2);
1097
1098 regval = status & mask;
1099 if (regval) {
> 1100 if (data->revision >= PMBUS_REV_12)
1101 ret = _pmbus_write_byte_data(client, page, reg, regval);
1102 else
1103 pmbus_clear_fault_page(client, page);
1104
1105 if (ret)
1106 goto unlock;
1107 }
1108 if (s1 && s2) {
1109 s64 v1, v2;
1110
1111 if (s1->data < 0) {
1112 ret = s1->data;
1113 goto unlock;
1114 }
1115 if (s2->data < 0) {
1116 ret = s2->data;
1117 goto unlock;
1118 }
1119
1120 v1 = pmbus_reg2data(data, s1);
1121 v2 = pmbus_reg2data(data, s2);
1122 ret = !!(regval && v1 >= v2);
1123 } else {
1124 ret = !!regval;
1125 }
1126 unlock:
1127 mutex_unlock(&data->update_lock);
1128 return ret;
1129 }
1130
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists