From: kernel test robot <lkp@intel.com>
To: fenghui <fenghui@nfschina.com>,
wim@linux-watchdog.org, linux@roeck-us.net
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
fenghui <fenghui@nfschina.com>
Subject: Re: [PATCH] watchdog_dev: Remove unnecessary ‘0’ values from err
Date: Tue, 24 Oct 2023 23:55:29 +0800 [thread overview]
Message-ID: <202310242358.POvbqd5T-lkp@intel.com> (raw)
In-Reply-To: <20231021110538.441-1-fenghui@nfschina.com>
Hi fenghui,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc7 next-20231024]
[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/fenghui/watchdog_dev-Remove-unnecessary-0-values-from-err/20231021-190730
base: linus/master
patch link: https://lore.kernel.org/r/20231021110538.441-1-fenghui%40nfschina.com
patch subject: [PATCH] watchdog_dev: Remove unnecessary ‘0’ values from err
config: arm-omap1_defconfig (https://download.01.org/0day-ci/archive/20231024/202310242358.POvbqd5T-lkp@intel.com/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/20231024/202310242358.POvbqd5T-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310242358.POvbqd5T-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/watchdog/watchdog_dev.c:305:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
305 | if (wdd->ops->stop) {
| ^~~~~~~~~~~~~~
drivers/watchdog/watchdog_dev.c:313:6: note: uninitialized use occurs here
313 | if (err == 0) {
| ^~~
drivers/watchdog/watchdog_dev.c:305:2: note: remove the 'if' if its condition is always true
305 | if (wdd->ops->stop) {
| ^~~~~~~~~~~~~~~~~~~~
306 | clear_bit(WDOG_HW_RUNNING, &wdd->status);
307 | err = wdd->ops->stop(wdd);
308 | trace_watchdog_stop(wdd, err);
309 | } else {
| ~~~~~~~
310 | set_bit(WDOG_HW_RUNNING, &wdd->status);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311 | }
| ~~~~~~~~~
drivers/watchdog/watchdog_dev.c:294:9: note: initialize the variable 'err' to silence this warning
294 | int err;
| ^
| = 0
1 warning generated.
vim +305 drivers/watchdog/watchdog_dev.c
234445b4e4542f Wim Van Sebroeck 2011-07-22 281
234445b4e4542f Wim Van Sebroeck 2011-07-22 282 /*
ba6c89ab3b5878 Daniel Bristot de Oliveira 2022-02-11 283 * watchdog_stop - wrapper to stop the watchdog
ba6c89ab3b5878 Daniel Bristot de Oliveira 2022-02-11 284 * @wdd: The watchdog device to stop
b4ffb1909843b2 Guenter Roeck 2015-12-25 285 *
234445b4e4542f Wim Van Sebroeck 2011-07-22 286 * Stop the watchdog if it is still active and unmark it active.
7e192b9c4234d2 Wim Van Sebroeck 2011-07-22 287 * If the 'nowayout' feature was set, the watchdog cannot be stopped.
ba6c89ab3b5878 Daniel Bristot de Oliveira 2022-02-11 288 * The caller must hold wd_data->lock.
ba6c89ab3b5878 Daniel Bristot de Oliveira 2022-02-11 289 *
ba6c89ab3b5878 Daniel Bristot de Oliveira 2022-02-11 290 * Return: 0 on success or a negative errno code for failure.
234445b4e4542f Wim Van Sebroeck 2011-07-22 291 */
bc794ac3b5836e Guenter Roeck 2015-09-29 292 static int watchdog_stop(struct watchdog_device *wdd)
234445b4e4542f Wim Van Sebroeck 2011-07-22 293 {
585c761ac0ef85 fenghui 2023-10-21 294 int err;
e907df32725204 Hans de Goede 2012-05-22 295
bc794ac3b5836e Guenter Roeck 2015-09-29 296 if (!watchdog_active(wdd))
b4ffb1909843b2 Guenter Roeck 2015-12-25 297 return 0;
7e192b9c4234d2 Wim Van Sebroeck 2011-07-22 298
bc794ac3b5836e Guenter Roeck 2015-09-29 299 if (test_bit(WDOG_NO_WAY_OUT, &wdd->status)) {
0254e953537c92 Guenter Roeck 2016-01-03 300 pr_info("watchdog%d: nowayout prevents watchdog being stopped!\n",
0254e953537c92 Guenter Roeck 2016-01-03 301 wdd->id);
b4ffb1909843b2 Guenter Roeck 2015-12-25 302 return -EBUSY;
7e192b9c4234d2 Wim Van Sebroeck 2011-07-22 303 }
234445b4e4542f Wim Van Sebroeck 2011-07-22 304
3c10bbde10fe4d Guenter Roeck 2016-07-21 @305 if (wdd->ops->stop) {
3c10bbde10fe4d Guenter Roeck 2016-07-21 306 clear_bit(WDOG_HW_RUNNING, &wdd->status);
bc794ac3b5836e Guenter Roeck 2015-09-29 307 err = wdd->ops->stop(wdd);
e25b091bed4946 Uwe Kleine-König 2022-10-08 308 trace_watchdog_stop(wdd, err);
3c10bbde10fe4d Guenter Roeck 2016-07-21 309 } else {
d0684c8a935495 Guenter Roeck 2016-02-28 310 set_bit(WDOG_HW_RUNNING, &wdd->status);
3c10bbde10fe4d Guenter Roeck 2016-07-21 311 }
d0684c8a935495 Guenter Roeck 2016-02-28 312
664a39236e718f Guenter Roeck 2016-02-28 313 if (err == 0) {
bc794ac3b5836e Guenter Roeck 2015-09-29 314 clear_bit(WDOG_ACTIVE, &wdd->status);
ee142889e32f56 Guenter Roeck 2016-02-28 315 watchdog_update_worker(wdd);
7b7d2fdc8c3e3f Curtis Klein 2021-02-03 316 watchdog_hrtimer_pretimeout_stop(wdd);
664a39236e718f Guenter Roeck 2016-02-28 317 }
7a87982420e5e1 Hans de Goede 2012-05-22 318
234445b4e4542f Wim Van Sebroeck 2011-07-22 319 return err;
7a87982420e5e1 Hans de Goede 2012-05-22 320 }
234445b4e4542f Wim Van Sebroeck 2011-07-22 321
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2023-10-24 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-21 11:05 [PATCH] watchdog_dev: Remove unnecessary ‘0’ values from err fenghui
2023-10-23 0:03 ` Guenter Roeck
2023-10-24 15:55 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202310242358.POvbqd5T-lkp@intel.com \
--to=lkp@intel.com \
--cc=fenghui@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).