[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGG=3QVTyEC5NdLFAwy=SYn7CEKYTE9wF00KMzDutEvXoQesZQ@mail.gmail.com>
Date: Mon, 21 Mar 2022 10:50:14 -0700
From: Bill Wendling <morbo@...gle.com>
To: Bjorn Andersson <bjorn.andersson@...aro.org>
Cc: Nathan Chancellor <nathan@...nel.org>,
Andy Gross <agross@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
linux-arm-msm@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH] soc: qcom: smem: use correct format characters
On Mon, Mar 21, 2022 at 8:24 AM Bjorn Andersson
<bjorn.andersson@...aro.org> wrote:
>
> On Fri 18 Mar 13:27 CDT 2022, Bill Wendling wrote:
>
> > On Fri, Mar 18, 2022 at 11:02 AM Nathan Chancellor <nathan@...nel.org> wrote:
> > >
> > > On Wed, Mar 16, 2022 at 02:31:18PM -0700, Bill Wendling wrote:
> > > > When compiling with -Wformat, clang emits the following warnings:
> > > >
> > > > drivers/soc/qcom/smem.c:847:41: warning: format specifies type 'unsigned
> > > > short' but the argument has type 'unsigned int' [-Wformat]
> > > > dev_err(smem->dev, "bad host %hu\n", remote_host);
> > > > ~~~ ^~~~~~~~~~~
> > > > %u
> > > > ./include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
> > > > dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > > ~~~ ^~~~~~~~~~~
> > > > ./include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
> > > > _p_func(dev, fmt, ##__VA_ARGS__); \
> > > > ~~~ ^~~~~~~~~~~
> > > > drivers/soc/qcom/smem.c:852:47: warning: format specifies type 'unsigned
> > > > short' but the argument has type 'unsigned int' [-Wformat]
> > > > dev_err(smem->dev, "duplicate host %hu\n", remote_host);
> > > > ~~~ ^~~~~~~~~~~
> > > > %u
> > > > ./include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
> > > > dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > > ~~~ ^~~~~~~~~~~
> > > > ./include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
> > > > _p_func(dev, fmt, ##__VA_ARGS__); \
> > > > ~~~ ^~~~~~~~~~~
> > > >
> > > > The types of these arguments are unconditionally defined, so this patch
> > > > updates the format character to the correct ones for ints and unsigned
> > > > ints.
> > >
> > > Right. Alternatively, remote_host could be turned into a u16 to match
> > > host0 and host1, as those are the only values that will ever be assigned
> > > to it, which should have been done in commit 13a920ae7898 ("soc: qcom:
> > > smem: a few last cleanups") to avoid introducing this warning in the
> > > first place.
> > >
> > I'll be happy to redo the patch if the maintainers wish. :-)
> >
>
> Forgive me, but I think that not mixing the unsigned int and u16 would
> look better. So if you're willing to respin this to change the type of
> remote_host, I'd be happy to merge that.
>
Happy to do so! I sent out v2 of this patch. (I didn't mark it as
"PATCH v2" because I forgot about that. Sorry. :-( ).
-bw
Powered by blists - more mailing lists