soc: qcom: smem: use correct format characters
Subsystems (2)
PATCH 1/1 soc: qcom: smem: use correct format characters
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.
--- drivers/soc/qcom/smem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/qcom/smem.c +2 -2
@@ -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 ; }
Signature · 1 line
2.35.1.723.g4982287a31-goog
Quoted 2 lines · Bill Wendling
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
Quoted 5 lines · Trilok Soni
Quoted 2 lines · Bill Wendling
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
Quoted 25 lines · 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__); \ ~~~ ^~~~~~~~~~~
Quoted 3 lines
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.
Quoted 1 line
Link ClangBuiltLinux/linux#378
as discussed on other patches :)
Quoted 1 line
Signed-off-by Bill Wendling <[email protected]>
Quoted 27 lines
--- drivers/soc/qcom/smem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soc/qcom/smem.c +2
-2@@ -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 ; }Signature · 1 line
2.35.1.723.g4982287a31-goog
Quoted 31 lines · Nathan Chancellor
Quoted 25 lines · 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__); \ ~~~ ^~~~~~~~~~~Quoted 3 lines
The types of these arguments are unconditionally defined, so this patch updates the format character to the correct ones for ints and unsigned ints.
Quoted 6 lines
Right. Alternatively,
remote_hostcould 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 commit13a920ae7898("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. :-)
Quoted 9 lines
Probably does not matter though, unless the maintainers feel that is a better fix.
Quoted 1 line
Link ClangBuiltLinux/linux#378as discussed on other patches :)
Thanks! Copy-and-paste strikes again...
-bw
Quoted 31 lines
Quoted 1 line
Signed-off-by Bill Wendling <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>Quoted 27 lines
--- drivers/soc/qcom/smem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soc/qcom/smem.c +2
-3@@ -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
Quoted 32 lines · Bill Wendling
Quoted 31 lines · Nathan Chancellor
Quoted 28 lines · 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.
Quoted 8 lines
Quoted 6 lines
Right. Alternatively,
remote_hostcould 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 commit13a920ae7898("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
Quoted 44 lines
Quoted 9 lines
Probably does not matter though, unless the maintainers feel that is a better fix.
Quoted 1 line
Link ClangBuiltLinux/linux#378as discussed on other patches :)
Thanks! Copy-and-paste strikes again...
-bw
Quoted 31 lines
Quoted 1 line
Signed-off-by Bill Wendling <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>Quoted 27 lines
--- drivers/soc/qcom/smem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soc/qcom/smem.c +2
-3@@ -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
Quoted 41 lines · Bjorn Andersson
Quoted 38 lines · Bill Wendling
Quoted 37 lines · Nathan Chancellor
Quoted 25 lines · 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__); \ ~~~ ^~~~~~~~~~~Quoted 3 lines
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_hostcould 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 commit13a920ae7898("soc: qcom:
smem: a few last cleanups") to avoid introducing this warning in the first place.
Quoted 7 lines
Quoted 2 lines
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
PATCH 1/1 soc: qcom: smem: use correct format characters
In reply to Bill WendlingWhen 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.
--- drivers/soc/qcom/smem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/soc/qcom/smem.c +3 -3
@@ -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 ; }
Signature · 1 line
2.35.1.894.gb6a874cedc-goog
Quoted 25 lines · 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__); \ ~~~ ^~~~~~~~~~~
Quoted 4 lines
The types of these arguments are unconditionally defined, so this patch updates the format character to the correct one and change type of
remote_hostto "u16" to match with other types.
This patch LGTM and fixes -Wformat warning.
Quoted 38 lines
Signed-off-by Bill Wendling <[email protected]>--- drivers/soc/qcom/smem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/soc/qcom/smem.c +3
-3@@ -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 ; }Signature · 1 line
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/[email protected]/
Quoted 76 lines · Justin Stitt
Quoted 25 lines · 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__); \ ~~~ ^~~~~~~~~~~Quoted 4 lines
The types of these arguments are unconditionally defined, so this patch updates the format character to the correct one and change type of
remote_hostto "u16" to match with other types.This patch LGTM and fixes -Wformat warning.
Tested-by Justin Stitt <[email protected]>Reviewed-by Justin Stitt <[email protected]>Quoted 38 lines
Signed-off-by Bill Wendling <[email protected]>--- drivers/soc/qcom/smem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/soc/qcom/smem.c +3
-4@@ -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
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 5 lines · Nick Desaulniers
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/[email protected]/
Applied with minor conflict resolution.
Arnd