lkml.org 
[lkml]   [2022]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [kbuild] drivers/firmware/arm_scmi/clock.c:242:40: warning: Variable 'msg' is not assigned a value. [unassignedVariable]
On Mon, May 30, 2022 at 10:04:55AM +0100, Cristian Marussi wrote:
> On Fri, May 27, 2022 at 11:57:29AM +0300, Dan Carpenter wrote:
> > 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>
> >
>
> Hi Dan,
>
> thanks for the report.
>
> > 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.
>
> I'll do.
>
> >
> > 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).
> >
>
> Probably a leftover from a previous version of the series where msg was
> usaed not only for sizeof()....I'll send a fix anyway to silence the
> bot.

... and btw there are a bunch of similar other sizeof(*msg) in a few
other SCMI protocols when calling the same response_init() helper...
..even though innocuos...I'll fix all of these to avoid needless stuff
on the stack.

Thanks,
Cristian

\
 
 \ /
  Last update: 2022-05-30 12:11    [W:0.104 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site