* [PATCH] soc: qcom: smem: use correct format characters
@ 2022-03-16 21:31 Bill Wendling
2022-03-16 23:17 ` Trilok Soni
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Bill Wendling @ 2022-03-16 21:31 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Nathan Chancellor, Nick Desaulniers,
linux-arm-msm, linux-kernel, llvm
Cc: Bill Wendling
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.
Link: ClangBuiltLinux/linux#378
Signed-off-by: Bill Wendling <morbo@google.com>
---
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
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-21 17:49 ` Bill Wendling
2 siblings, 1 reply; 11+ messages in thread
From: Trilok Soni @ 2022-03-16 23:17 UTC (permalink / raw)
To: Bill Wendling, Andy Gross, Bjorn Andersson, Nathan Chancellor,
Nick Desaulniers, linux-arm-msm, linux-kernel, llvm
On 3/16/2022 2:31 PM, Bill Wendling wrote:
> When compiling with -Wformat, clang emits the following warnings:
>
I thought we have -Wno-format by default enabled for arm64, isn't it?
---Trilok Soni
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-16 23:17 ` Trilok Soni
@ 2022-03-16 23:25 ` Nathan Chancellor
0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-16 23:25 UTC (permalink / raw)
To: Trilok Soni
Cc: Bill Wendling, Andy Gross, Bjorn Andersson, Nick Desaulniers,
linux-arm-msm, linux-kernel, llvm
On Wed, Mar 16, 2022 at 04:17:06PM -0700, Trilok Soni wrote:
> On 3/16/2022 2:31 PM, Bill Wendling wrote:
> > When compiling with -Wformat, clang emits the following warnings:
> >
>
> I thought we have -Wno-format by default enabled for arm64, isn't it?
Yes, -Wformat is turned off for clang in the default kernel build on all
architectures (see scripts/Makefile.extrawarn). However, it can easily
be enabled with W=1 and we should eventually get this turned on for
clang like gcc so that developers who only use clang can catch instances
of it.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-16 21:31 [PATCH] soc: qcom: smem: use correct format characters Bill Wendling
2022-03-16 23:17 ` Trilok Soni
@ 2022-03-18 18:02 ` Nathan Chancellor
2022-03-18 18:27 ` Bill Wendling
2022-03-21 17:49 ` Bill Wendling
2 siblings, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-18 18:02 UTC (permalink / raw)
To: Bill Wendling
Cc: Andy Gross, Bjorn Andersson, Nick Desaulniers, linux-arm-msm,
linux-kernel, llvm
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.
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 :)
> 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
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-18 18:02 ` Nathan Chancellor
@ 2022-03-18 18:27 ` Bill Wendling
2022-03-21 15:24 ` Bjorn Andersson
0 siblings, 1 reply; 11+ messages in thread
From: Bill Wendling @ 2022-03-18 18:27 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Andy Gross, Bjorn Andersson, Nick Desaulniers, linux-arm-msm, LKML, llvm
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. :-)
> 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
> >
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-18 18:27 ` Bill Wendling
@ 2022-03-21 15:24 ` Bjorn Andersson
2022-03-21 17:50 ` Bill Wendling
0 siblings, 1 reply; 11+ messages in thread
From: Bjorn Andersson @ 2022-03-21 15:24 UTC (permalink / raw)
To: Bill Wendling
Cc: Nathan Chancellor, Andy Gross, Nick Desaulniers, linux-arm-msm,
LKML, llvm
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
> > >
> > >
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] soc: qcom: smem: use correct format characters
2022-03-16 21:31 [PATCH] soc: qcom: smem: use correct format characters Bill Wendling
2022-03-16 23:17 ` Trilok Soni
2022-03-18 18:02 ` Nathan Chancellor
@ 2022-03-21 17:49 ` Bill Wendling
2022-06-03 21:03 ` Justin Stitt
2 siblings, 1 reply; 11+ messages in thread
From: Bill Wendling @ 2022-03-21 17:49 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Nathan Chancellor, Nick Desaulniers,
linux-arm-msm, linux-kernel, llvm
Cc: Bill Wendling
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 one and change type of
remote_host to "u16" to match with other types.
Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Bill Wendling <morbo@google.com>
---
drivers/soc/qcom/smem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index e2057d8f1eff..9dd325df5682 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -819,7 +819,7 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
struct smem_partition_header *header;
struct smem_ptable_entry *entry;
struct smem_ptable *ptable;
- unsigned int remote_host;
+ u16 remote_host;
u16 host0, host1;
int i;
@@ -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.894.gb6a874cedc-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-21 15:24 ` Bjorn Andersson
@ 2022-03-21 17:50 ` Bill Wendling
0 siblings, 0 replies; 11+ messages in thread
From: Bill Wendling @ 2022-03-21 17:50 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Nathan Chancellor, Andy Gross, Nick Desaulniers, linux-arm-msm,
LKML, llvm
On Mon, Mar 21, 2022 at 8:24 AM Bjorn Andersson
<bjorn.andersson@linaro.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@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.
>
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-03-21 17:49 ` Bill Wendling
@ 2022-06-03 21:03 ` Justin Stitt
2022-07-01 22:05 ` Nick Desaulniers
0 siblings, 1 reply; 11+ messages in thread
From: Justin Stitt @ 2022-06-03 21:03 UTC (permalink / raw)
To: Bill Wendling
Cc: Andy Gross, Bjorn Andersson, Nathan Chancellor, Nick Desaulniers,
linux-arm-msm, linux-kernel, llvm
On Mon, Mar 21, 2022 at 10:49:12AM -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 one and change type of
> remote_host to "u16" to match with other types.
>
This patch LGTM and fixes -Wformat warning.
Tested-by: Justin Stitt <jstitt007@gmail.com>
Reviewed-by: Justin Stitt <jstitt007@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Bill Wendling <morbo@google.com>
> ---
> drivers/soc/qcom/smem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index e2057d8f1eff..9dd325df5682 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -819,7 +819,7 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
> struct smem_partition_header *header;
> struct smem_ptable_entry *entry;
> struct smem_ptable *ptable;
> - unsigned int remote_host;
> + u16 remote_host;
> u16 host0, host1;
> int i;
>
> @@ -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.894.gb6a874cedc-goog
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-06-03 21:03 ` Justin Stitt
@ 2022-07-01 22:05 ` Nick Desaulniers
2022-07-04 12:28 ` Arnd Bergmann
0 siblings, 1 reply; 11+ messages in thread
From: Nick Desaulniers @ 2022-07-01 22:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bill Wendling, Andy Gross, Bjorn Andersson, Nathan Chancellor,
linux-arm-msm, linux-kernel, llvm, Justin Stitt
Hi Arnd,
Would you be able to merge this patch through the arm-soc tree? The
maintainers appear to be MIA here.
https://lore.kernel.org/lkml/20220321174912.164113-1-morbo@google.com/
On Fri, Jun 3, 2022 at 2:03 PM Justin Stitt <jstitt007@gmail.com> wrote:
>
> On Mon, Mar 21, 2022 at 10:49:12AM -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 one and change type of
> > remote_host to "u16" to match with other types.
> >
>
> This patch LGTM and fixes -Wformat warning.
>
> Tested-by: Justin Stitt <jstitt007@gmail.com>
> Reviewed-by: Justin Stitt <jstitt007@gmail.com>
>
> > Link: https://github.com/ClangBuiltLinux/linux/issues/378
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > ---
> > drivers/soc/qcom/smem.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > index e2057d8f1eff..9dd325df5682 100644
> > --- a/drivers/soc/qcom/smem.c
> > +++ b/drivers/soc/qcom/smem.c
> > @@ -819,7 +819,7 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
> > struct smem_partition_header *header;
> > struct smem_ptable_entry *entry;
> > struct smem_ptable *ptable;
> > - unsigned int remote_host;
> > + u16 remote_host;
> > u16 host0, host1;
> > int i;
> >
> > @@ -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.894.gb6a874cedc-goog
> >
> >
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] soc: qcom: smem: use correct format characters
2022-07-01 22:05 ` Nick Desaulniers
@ 2022-07-04 12:28 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2022-07-04 12:28 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Bill Wendling, Andy Gross, Bjorn Andersson, Nathan Chancellor,
linux-arm-msm, Linux Kernel Mailing List, clang-built-linux,
Justin Stitt
On Sat, Jul 2, 2022 at 12:05 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> Hi Arnd,
> Would you be able to merge this patch through the arm-soc tree? The
> maintainers appear to be MIA here.
> https://lore.kernel.org/lkml/20220321174912.164113-1-morbo@google.com/
Applied with minor conflict resolution.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-07-04 12:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.