From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Cristian Marussi <cristian.marussi@arm.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org, Sudeep Holla <sudeep.holla@arm.com>
Subject: [kbuild] drivers/firmware/arm_scmi/clock.c:242:40: warning: Variable 'msg' is not assigned a value. [unassignedVariable]
Date: Fri, 27 May 2022 11:57:29 +0300 [thread overview]
Message-ID: <202205271608.aIWtyM7b-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7e284070abe53d448517b80493863595af4ab5f0
commit: 7bc7caafe6b1e5b882255a42bc1bf112fa87b69b firmware: arm_scmi: Use common iterators in the clock protocol
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout 7bc7caafe6b1e5b882255a42bc1bf112fa87b69b
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/firmware/arm_scmi/clock.c:242:40: warning: Variable 'msg' is not assigned a value. [unassignedVariable]
struct scmi_msg_clock_describe_rates *msg;
^
vim +/msg +242 drivers/firmware/arm_scmi/clock.c
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 235 static int
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 236 scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 237 struct scmi_clock_info *clk)
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 238 {
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 239 int ret;
5f6c6430e904d2 Sudeep Holla 2017-06-06 240
Please delete the blank line.
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 241 void *iter;
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 @242 struct scmi_msg_clock_describe_rates *msg;
I was so surprised that GCC doesn't warn about this but "msg" is only
used to calculate the sizeof(*msg).
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 243 struct scmi_iterator_ops ops = {
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 244 .prepare_message = iter_clk_describe_prepare_message,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 245 .update_state = iter_clk_describe_update_state,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 246 .process_response = iter_clk_describe_process_response,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 247 };
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 248 struct scmi_clk_ipriv cpriv = {
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 249 .clk_id = clk_id,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 250 .clk = clk,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 251 };
5f6c6430e904d2 Sudeep Holla 2017-06-06 252
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 253 iter = ph->hops->iter_response_init(ph, &ops, SCMI_MAX_NUM_RATES,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 254 CLOCK_DESCRIBE_RATES,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 255 sizeof(*msg), &cpriv);
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 256 if (IS_ERR(iter))
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 257 return PTR_ERR(iter);
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 258
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 259 ret = ph->hops->iter_response_run(iter);
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 260 if (ret)
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 261 return ret;
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 262
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 263 if (!clk->rate_discrete) {
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 264 dev_dbg(ph->dev, "Min %llu Max %llu Step %llu Hz\n",
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 265 clk->range.min_rate, clk->range.max_rate,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 266 clk->range.step_size);
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 267 } else if (clk->list.num_rates) {
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 268 sort(clk->list.rates, clk->list.num_rates,
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 269 sizeof(clk->list.rates[0]), rate_cmp_func, NULL);
7bc7caafe6b1e5 Cristian Marussi 2022-03-30 270 }
c0759b9b5d411a Peng Fan 2019-05-22 271
5f6c6430e904d2 Sudeep Holla 2017-06-06 272 return ret;
5f6c6430e904d2 Sudeep Holla 2017-06-06 273 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
next reply other threads:[~2022-05-27 9:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 8:57 Dan Carpenter [this message]
2022-05-30 9:04 ` Cristian Marussi
2022-05-30 10:08 ` Cristian Marussi
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=202205271608.aIWtyM7b-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=cristian.marussi@arm.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=sudeep.holla@arm.com \
/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
all inboxes | Powered by JetHome®