From: kernel test robot <lkp@intel.com>
To: James Morse <james.morse@arm.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org
Subject: [morse:mpam/snapshot/v5.18 97/146] drivers/platform/mpam/mpam_devices.c:71:14: warning: variable 'cache' is used uninitialized whenever 'if' condition is false
Date: Mon, 20 Jun 2022 02:42:33 +0800 [thread overview]
Message-ID: <202206200258.OlfMsjF6-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/snapshot/v5.18
head: bac90d25cbdee0fc233b9b1c47d5b6f44101a384
commit: 49e55977a0ed88794b6abe4c959e3e28ccd54913 [97/146] arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220620/202206200258.OlfMsjF6-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/commit/?id=49e55977a0ed88794b6abe4c959e3e28ccd54913
git remote add morse https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git
git fetch --no-tags morse mpam/snapshot/v5.18
git checkout 49e55977a0ed88794b6abe4c959e3e28ccd54913
# 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=arm64 SHELL=/bin/bash drivers/perf/ drivers/platform/mpam/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/platform/mpam/mpam_devices.c:71:14: warning: variable 'cache' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (of_device_is_compatible(np->parent, "cache")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/mpam/mpam_devices.c:93:14: note: uninitialized use occurs here
of_node_put(cache);
^~~~~
drivers/platform/mpam/mpam_devices.c:71:10: note: remove the 'if' if its condition is always true
} else if (of_device_is_compatible(np->parent, "cache")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/mpam/mpam_devices.c:62:27: note: initialize the variable 'cache' to silence this warning
struct device_node *cache;
^
= NULL
1 warning generated.
vim +71 drivers/platform/mpam/mpam_devices.c
55
56 static int mpam_dt_parse_resource(struct mpam_msc *msc, struct device_node *np,
57 u32 ris_idx)
58 {
59 int err = 0;
60 u32 level = 0;
61 unsigned long cache_id;
62 struct device_node *cache;
63
64 do {
65 if (of_device_is_compatible(np, "arm,mpam-cache")) {
66 cache = of_parse_phandle(np, "arm,mpam-device", 0);
67 if (!cache) {
68 pr_err("Failed to read phandle\n");
69 break;
70 }
> 71 } else if (of_device_is_compatible(np->parent, "cache")) {
72 cache = np->parent;
73 } else {
74 pr_err("Not a cache\n");
75 break;
76 }
77
78 err = of_property_read_u32(cache, "cache-level", &level);
79 if (err) {
80 pr_err("Failed to read cache-level\n");
81 break;
82 }
83
84 cache_id = cache_of_get_id(cache);
85 if (cache_id == ~0UL) {
86 err = -ENOENT;
87 break;
88 }
89
90 err = mpam_ris_create(msc, ris_idx, MPAM_CLASS_CACHE, level,
91 cache_id);
92 } while (0);
93 of_node_put(cache);
94
95 return err;
96 }
97
--
0-DAY CI Kernel Test Service
https://01.org/lkp
reply other threads:[~2022-06-19 18:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202206200258.OlfMsjF6-lkp@intel.com \
--to=lkp@intel.com \
--cc=james.morse@arm.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
/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