[PATCH] powernv: Use __printf in pe_level_printk

Michael Ellerman mpe at ellerman.id.au
Fri Jul 15 14:36:17 AEST 2016


Joe Perches <joe at perches.com> writes:

> Make the compiler detect format and argument mismatches.
>
> Signed-off-by: Joe Perches <joe at perches.com>
> ---
>  arch/powerpc/platforms/powernv/pci.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> index 3a97990..1c1a586 100644
> --- a/arch/powerpc/platforms/powernv/pci.h
> +++ b/arch/powerpc/platforms/powernv/pci.h
> @@ -213,6 +213,7 @@ extern void pnv_pci_dma_bus_setup(struct pci_bus *bus);
>  extern int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
>  extern void pnv_teardown_msi_irqs(struct pci_dev *pdev);
>  
> +__printf(3, 4)
>  extern void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
>  			    const char *fmt, ...);

Thanks, but it breaks the build due to lots of new warnings.

We'll have to fix those before merging it.

cheers

In file included from ../arch/powerpc/platforms/powernv/pci-ioda.c:49:0:
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_ioda_deconfigure_pe’:
../arch/powerpc/platforms/powernv/pci-ioda.c:784:15: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
   pe_warn(pe, "OPAL error %ld remove self from PELTV\n", rc);
               ^
../arch/powerpc/platforms/powernv/pci.h:233:36: note: in definition of macro ‘pe_warn’
  pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
                                    ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c:788:14: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
   pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc);
              ^
../arch/powerpc/platforms/powernv/pci.h:231:32: note: in definition of macro ‘pe_err’
  pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
                                ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_ioda_setup_bus_PE’:
../arch/powerpc/platforms/powernv/pci-ioda.c:1095:15: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘resource_size_t {aka long long unsigned int}’ [-Werror=format=]
   pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n",
               ^
../arch/powerpc/platforms/powernv/pci.h:235:33: note: in definition of macro ‘pe_info’
  pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
                                 ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c:1095:15: error: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘resource_size_t {aka long long unsigned int}’ [-Werror=format=]
   pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n",
               ^
../arch/powerpc/platforms/powernv/pci.h:235:33: note: in definition of macro ‘pe_info’
  pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
                                 ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c:1098:15: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘resource_size_t {aka long long unsigned int}’ [-Werror=format=]
   pe_info(pe, "Secondary bus %d associated with PE#%d\n",
               ^
../arch/powerpc/platforms/powernv/pci.h:235:33: note: in definition of macro ‘pe_info’
  pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
                                 ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_pci_ioda2_release_dma_pe’:
../arch/powerpc/platforms/powernv/pci-ioda.c:1351:15: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
   pe_warn(pe, "OPAL error %ld release DMA window\n", rc);
               ^
../arch/powerpc/platforms/powernv/pci.h:233:36: note: in definition of macro ‘pe_warn’
  pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
                                    ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_pci_ioda1_setup_dma_pe’:
../arch/powerpc/platforms/powernv/pci-ioda.c:2093:15: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
    pe_err(pe, " Failed to configure 32-bit TCE table,"
               ^
../arch/powerpc/platforms/powernv/pci.h:231:32: note: in definition of macro ‘pe_err’
  pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
                                ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_pci_ioda2_set_window’:
../arch/powerpc/platforms/powernv/pci-ioda.c:2153:14: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘long unsigned int’ [-Werror=format=]
  pe_info(pe, "Setting up window#%d %llx..%llx pg=%x\n", num,
              ^
../arch/powerpc/platforms/powernv/pci.h:235:33: note: in definition of macro ‘pe_info’
  pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
                                 ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c:2169:14: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
   pe_err(pe, "Failed to configure TCE table, err %ld\n", rc);
              ^
../arch/powerpc/platforms/powernv/pci.h:231:32: note: in definition of macro ‘pe_err’
  pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
                                ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_pci_ioda2_release_pe_dma’:
../arch/powerpc/platforms/powernv/pci-ioda.c:3312:15: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
   pe_warn(pe, "OPAL error %ld release DMA window\n", rc);
               ^
../arch/powerpc/platforms/powernv/pci.h:233:36: note: in definition of macro ‘pe_warn’
  pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
                                    ^~~
../arch/powerpc/platforms/powernv/pci-ioda.c: In function ‘pnv_ioda_free_pe_seg’:
../arch/powerpc/platforms/powernv/pci-ioda.c:3347:16: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t {aka long long int}’ [-Werror=format=]
    pe_warn(pe, "Error %ld unmapping (%d) segment#%d\n",
                ^
../arch/powerpc/platforms/powernv/pci.h:233:36: note: in definition of macro ‘pe_warn’
  pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
                                    ^~~


More information about the Linuxppc-dev mailing list