Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Bill Wendling <morbo@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Andy Gross <agross@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-arm-msm@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] soc: qcom: smem: use correct format characters
Date: Mon, 21 Mar 2022 10:24:30 -0500	[thread overview]
Message-ID: <YjiYrj5euvidRKHM@builder.lan> (raw)
In-Reply-To: <CAGG=3QUXDj1Bp1kDY2F0dqw=6f8iRqE4nRDyticUrWx-nTb-=A@mail.gmail.com>

On Fri 18 Mar 13:27 CDT 2022, Bill Wendling wrote:

> On Fri, Mar 18, 2022 at 11:02 AM Nathan Chancellor <nathan@kernel.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.

Thanks,
Bjorn

> > Probably does not matter though, unless the maintainers feel that is a
> > better fix.
> >
> > > Link: ClangBuiltLinux/linux#378
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/378
> >
> > as discussed on other patches :)
> >
> Thanks! Copy-and-paste strikes again...
> 
> -bw
> 
> > > Signed-off-by: Bill Wendling <morbo@google.com>
> >
> > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> >
> > > ---
> > >  drivers/soc/qcom/smem.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > > index e2057d8f1eff..a98b5f395d15 100644
> > > --- a/drivers/soc/qcom/smem.c
> > > +++ b/drivers/soc/qcom/smem.c
> > > @@ -844,12 +844,12 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
> > >                       continue;
> > >
> > >               if (remote_host >= SMEM_HOST_COUNT) {
> > > -                     dev_err(smem->dev, "bad host %hu\n", remote_host);
> > > +                     dev_err(smem->dev, "bad host %u\n", remote_host);
> > >                       return -EINVAL;
> > >               }
> > >
> > >               if (smem->partitions[remote_host]) {
> > > -                     dev_err(smem->dev, "duplicate host %hu\n", remote_host);
> > > +                     dev_err(smem->dev, "duplicate host %u\n", remote_host);
> > >                       return -EINVAL;
> > >               }
> > >
> > > --
> > > 2.35.1.723.g4982287a31-goog
> > >
> > >

  reply	other threads:[~2022-03-21 15:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 21:31 [PATCH] soc: qcom: smem: use correct format characters Bill Wendling
2022-03-16 23:17 ` Trilok Soni
2022-03-16 23:25   ` Nathan Chancellor
2022-03-18 18:02 ` Nathan Chancellor
2022-03-18 18:27   ` Bill Wendling
2022-03-21 15:24     ` Bjorn Andersson [this message]
2022-03-21 17:50       ` Bill Wendling
2022-03-21 17:49 ` Bill Wendling
2022-06-03 21:03   ` Justin Stitt
2022-07-01 22:05     ` Nick Desaulniers
2022-07-04 12:28       ` Arnd Bergmann

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=YjiYrj5euvidRKHM@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.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