parisc: Use proper printk format for resource_size_t
PATCH 1/1 parisc: Use proper printk format for resource_size_t
resource_size_t should be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):
arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
arch/parisc/kernel/drivers.c:892:9: warning:
format '%p' expects argument of type 'void *',
but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
--- arch/parisc/kernel/drivers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/drivers.c +2 -2
@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)static int count;print_pa_hwpath (dev, hw_path); -pr_info ("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }" , - ++count, dev->name, (void *) dev->hpa.start, hw_path, dev->id.hw_type, +pr_info ("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }" , + ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type, dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);if (dev->num_addrs) {
Signature · 1 line
2.17.1
Helge Deller
maintainerQuoted 19 lines · Krzysztof Kozlowski
resource_size_tshould be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. withCOMPILE_TEST):
arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
arch/parisc/kernel/drivers.c:892:9: warning:
format '%p' expects argument of type 'void *',
but argument 4 has type 'resource_size_t{aka unsigned int}' [-Wformat=]Signed-off-by Krzysztof Kozlowski <[email protected]>--- arch/parisc/kernel/drivers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/parisc/kernel/drivers.c +0
-0
arch/parisc/kernel/drivers.c static void print_parisc_device(struct parisc_device *dev) · line 892
Quoted 6 lines
arch/parisc/kernel/drivers.c +1
-2@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)static int count;print_pa_hwpath (dev, hw_path); - pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", - ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type, + pr_info("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
It needs to be %pap instead of %pa[p].
The documentation in Documentation/core-api/printk-formats.rst is correct, but misleading. I corrected & applied it.
Thanks!
Helge
Quoted 5 lines
arch/parisc/kernel/drivers.c +1
-0+ ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type, dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);if (dev->num_addrs) {
Quoted 22 lines · Helge Deller
Quoted 21 lines · Krzysztof Kozlowski
resource_size_tshould be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. withCOMPILE_TEST):
arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
arch/parisc/kernel/drivers.c:892:9: warning:
format '%p' expects argument of type 'void *',
but argument 4 has type 'resource_size_t{aka unsigned int}' [-Wformat=]Signed-off-by Krzysztof Kozlowski <[email protected]>--- arch/parisc/kernel/drivers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/parisc/kernel/drivers.c +0
-0@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)static int count;
Quoted 9 lines
arch/parisc/kernel/drivers.c static void print_parisc_device(struct parisc_device *dev) · line 892
Quoted 4 lines
arch/parisc/kernel/drivers.c +1
-2print_pa_hwpath (dev, hw_path); - pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", - ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type, + pr_info("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",It needs to be %pap instead of %pa[p].
The documentation inDocumentation/core-api/printk-formats.rstis correct, but misleading. I corrected & applied it.
Thanks!
Damn it, you're right. Thanks for noticing!
Best regards,
Krzysztof