Re: [PATCH] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers

From: kernel test robot
Date: Sun Oct 29 2023 - 22:07:14 EST


Hi Aleksa,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.6-rc7 next-20231027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Aleksa-Savic/hwmon-Add-driver-for-Gigabyte-AORUS-Waterforce-AIO-coolers/20231020-210452
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link: https://lore.kernel.org/r/20231020130212.8919-1-savicaleksa83%40gmail.com
patch subject: [PATCH] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20231030/202310300959.8NLKyQDJ-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231030/202310300959.8NLKyQDJ-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310300959.8NLKyQDJ-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/hwmon/gigabyte_waterforce.c:130:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
130 | if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/gigabyte_waterforce.c:155:7: note: uninitialized use occurs here
155 | if (ret < 0)
| ^~~
drivers/hwmon/gigabyte_waterforce.c:130:3: note: remove the 'if' if its condition is always false
130 | if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131 | /* Data is up to date */
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 | goto unlock_and_return;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | }
| ~~~~~~~~~~~~~~~~~
drivers/hwmon/gigabyte_waterforce.c:127:9: note: initialize the variable 'ret' to silence this warning
127 | int ret;
| ^
| = 0
1 warning generated.


vim +130 drivers/hwmon/gigabyte_waterforce.c

124
125 static int waterforce_get_status(struct waterforce_data *priv)
126 {
127 int ret;
128
129 if (!mutex_lock_interruptible(&priv->status_report_request_mutex)) {
> 130 if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
131 /* Data is up to date */
132 goto unlock_and_return;
133 }
134
135 /*
136 * Disable raw event parsing for a moment to safely reinitialize the
137 * completion. Reinit is done because hidraw could have triggered
138 * the raw event parsing and marked the priv->status_report_received
139 * completion as done.
140 */
141 spin_lock_bh(&priv->status_report_request_lock);
142 reinit_completion(&priv->status_report_received);
143 spin_unlock_bh(&priv->status_report_request_lock);
144
145 /* Send command for getting status */
146 ret = waterforce_write_expanded(priv, get_status_cmd, GET_STATUS_CMD_LENGTH);
147 if (ret < 0)
148 return ret;
149
150 if (wait_for_completion_interruptible_timeout
151 (&priv->status_report_received, msecs_to_jiffies(STATUS_VALIDITY)) <= 0)
152 ret = -ENODATA;
153 unlock_and_return:
154 mutex_unlock(&priv->status_report_request_mutex);
155 if (ret < 0)
156 return ret;
157 } else {
158 return -ENODATA;
159 }
160
161 return 0;
162 }
163

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki