drivers/soc/qcom/smem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
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
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
>
>
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
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
© 2016 - 2026 Red Hat, Inc.