* [arm-tegra:hte/for-next 2/10] drivers/hte/hte.c:616:6: warning: variable 'ei' is used uninitialized whenever 'if' condition is true
@ 2022-05-03 23:47 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-05-03 23:47 UTC (permalink / raw)
To: Dipen Patel; +Cc: llvm, kbuild-all, linux-tegra, Thierry Reding
tree: https://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git hte/for-next
head: cedbe14082d169f4c1136c70c5170a76bd9a076a
commit: a15a6cd5adac70f8ea9188b55ff0b2899cc34e0f [2/10] drivers: Add hardware timestamp engine (HTE)
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220504/202205040735.Qhz7Bads-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 363b3a645a1e30011cc8da624f13dac5fd915628)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git/commit/?id=a15a6cd5adac70f8ea9188b55ff0b2899cc34e0f
git remote add arm-tegra https://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git
git fetch --no-tags arm-tegra hte/for-next
git checkout a15a6cd5adac70f8ea9188b55ff0b2899cc34e0f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hte/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/hte/hte.c:616:6: warning: variable 'ei' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ret < 0)
^~~~~~~
drivers/hte/hte.c:630:13: note: uninitialized use occurs here
module_put(ei->gdev->owner);
^~
drivers/hte/hte.c:616:2: note: remove the 'if' if its condition is always false
if (ret < 0)
^~~~~~~~~~~~
drivers/hte/hte.c:595:6: warning: variable 'ei' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!gdev->chip) {
^~~~~~~~~~~
drivers/hte/hte.c:630:13: note: uninitialized use occurs here
module_put(ei->gdev->owner);
^~
drivers/hte/hte.c:595:2: note: remove the 'if' if its condition is always false
if (!gdev->chip) {
^~~~~~~~~~~~~~~~~~
drivers/hte/hte.c:570:24: note: initialize the variable 'ei' to silence this warning
struct hte_ts_info *ei;
^
= NULL
2 warnings generated.
vim +616 drivers/hte/hte.c
551
552 /**
553 * hte_ts_get() - The function to initialize and obtain HTE desc.
554 *
555 * The function initializes the consumer provided HTE descriptor. If consumer
556 * has device tree node, index is used to parse the line id and other details.
557 * The function needs to be called before using any request APIs.
558 *
559 * @dev: HTE consumer/client device, used in case of parsing device tree node.
560 * @desc: Pre-allocated timestamp descriptor.
561 * @index: The index will be used as an index to parse line_id from the
562 * device tree node if node is present.
563 *
564 * Context: Holds mutex lock.
565 * Returns: Returns 0 on success or negative error code on failure.
566 */
567 int hte_ts_get(struct device *dev, struct hte_ts_desc *desc, int index)
568 {
569 struct hte_device *gdev;
570 struct hte_ts_info *ei;
571 const struct fwnode_handle *fwnode;
572 struct of_phandle_args args;
573 u32 xlated_id;
574 int ret;
575 bool free_name;
576
577 if (!desc)
578 return -EINVAL;
579
580 fwnode = dev ? dev_fwnode(dev) : NULL;
581
582 if (is_of_node(fwnode))
583 gdev = hte_of_get_dev(dev, desc, index, &args, &free_name);
584 else
585 gdev = hte_get_dev(desc);
586
587 if (IS_ERR(gdev)) {
588 pr_err("%s() no hte dev found\n", __func__);
589 return PTR_ERR(gdev);
590 }
591
592 if (!try_module_get(gdev->owner))
593 return -ENODEV;
594
595 if (!gdev->chip) {
596 pr_err("%s(): requested id does not have provider\n",
597 __func__);
598 ret = -ENODEV;
599 goto out;
600 }
601
602 if (is_of_node(fwnode)) {
603 if (!gdev->chip->xlate_of)
604 ret = -EINVAL;
605 else
606 ret = gdev->chip->xlate_of(gdev->chip, &args,
607 desc, &xlated_id);
608 } else {
609 if (!gdev->chip->xlate_plat)
610 ret = -EINVAL;
611 else
612 ret = gdev->chip->xlate_plat(gdev->chip, desc,
613 &xlated_id);
614 }
615
> 616 if (ret < 0)
617 goto out;
618
619 ei = &gdev->ei[xlated_id];
620
621 ret = hte_bind_ts_info_locked(ei, desc, xlated_id);
622 if (ret)
623 goto out;
624
625 ei->free_attr_name = free_name;
626
627 return 0;
628
629 out:
630 module_put(ei->gdev->owner);
631
632 return ret;
633 }
634 EXPORT_SYMBOL_GPL(hte_ts_get);
635
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-03 23:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-03 23:47 [arm-tegra:hte/for-next 2/10] drivers/hte/hte.c:616:6: warning: variable 'ei' is used uninitialized whenever 'if' condition is true kernel test robot
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 NNTP newsgroup(s).