diff mbox

mtd: nand: pasemi: switch to pr_* functions

Message ID 1460111589-18781-1-git-send-email-zajec5@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Rafał Miłecki April 8, 2016, 10:33 a.m. UTC
This patch also replaces %08llx with %08zx for printing resource start
address. Old format was triggering:
warning: format ‘%08llx’ expects type ‘long long unsigned int’, but argument 2 has type ‘resource_size_t’

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/mtd/nand/pasemi_nand.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Joe Perches April 8, 2016, 10:50 a.m. UTC | #1
On Fri, 2016-04-08 at 12:33 +0200, Rafał Miłecki wrote:
> This patch also replaces %08llx with %08zx for printing resource start
> address. Old format was triggering:
> warning: format ‘%08llx’ expects type ‘long long unsigned int’, but argument 2 has type ‘resource_size_t’

trivia:

> diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
[]
> @@ -112,8 +112,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
>  	/* Allocate memory for MTD device structure and private data */
>  	chip = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
>  	if (!chip) {
> -		printk(KERN_WARNING
> -		       "Unable to allocate PASEMI NAND MTD device structure\n");
> +		pr_warn("Unable to allocate PASEMI NAND MTD device structure\n");

Maybe remove this unnecessary as there's an OOM stack dump.

>  		err = -ENOMEM;
>  		goto out;
>  	}
> @@ -163,13 +162,13 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
>  	}
>  
>  	if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
> -		printk(KERN_ERR "pasemi_nand: Unable to register MTD device\n");
> +		pr_err("pasemi_nand: Unable to register MTD device\n");

Maybe remove the embedded "pasemi_nand: " and add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before the first #include?

>  		err = -ENODEV;
>  		goto out_lpc;
>  	}
>  
> -	printk(KERN_INFO "PA Semi NAND flash at %08llx, control at I/O %x\n",
> -	       res.start, lpcctl);
> +	pr_info("PA Semi NAND flash at %08zx, control at I/O %x\n", res.start,
> +		lpcctl);

Maybe use %pR, &res instead of res.start?

	pr_info("PA Semi NAND flash at %pR, control at I/O %x\n", &res, lpcctl);
kernel test robot April 8, 2016, 10:52 a.m. UTC | #2
Hi Rafał,

[auto build test WARNING on mtd/master]
[also build test WARNING on v4.6-rc2 next-20160408]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/mtd-nand-pasemi-switch-to-pr_-functions/20160408-183554
base:   git://git.infradead.org/linux-mtd.git master
config: powerpc-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:13,
                    from include/asm-generic/bug.h:13,
                    from arch/powerpc/include/asm/bug.h:127,
                    from include/linux/bug.h:4,
                    from include/linux/mmdebug.h:4,
                    from include/linux/gfp.h:4,
                    from include/linux/slab.h:14,
                    from drivers/mtd/nand/pasemi_nand.c:25:
   drivers/mtd/nand/pasemi_nand.c: In function 'pasemi_nand_probe':
   include/linux/kern_levels.h:4:18: warning: format '%zx' expects argument of type 'size_t', but argument 2 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:13:19: note: in expansion of macro 'KERN_SOH'
    #define KERN_INFO KERN_SOH "6" /* informational */
                      ^
   include/linux/printk.h:259:9: note: in expansion of macro 'KERN_INFO'
     printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
            ^
>> drivers/mtd/nand/pasemi_nand.c:169:2: note: in expansion of macro 'pr_info'
     pr_info("PA Semi NAND flash at %08zx, control at I/O %x\n", res.start,
     ^

vim +/pr_info +169 drivers/mtd/nand/pasemi_nand.c

   153	
   154		/* Enable the following for a flash based bad block table */
   155		chip->bbt_options = NAND_BBT_USE_FLASH;
   156	
   157		/* Scan to find existence of the device */
   158		if (nand_scan(pasemi_nand_mtd, 1)) {
   159			err = -ENXIO;
   160			goto out_lpc;
   161		}
   162	
   163		if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
   164			pr_err("pasemi_nand: Unable to register MTD device\n");
   165			err = -ENODEV;
   166			goto out_lpc;
   167		}
   168	
 > 169		pr_info("PA Semi NAND flash at %08zx, control at I/O %x\n", res.start,
   170			lpcctl);
   171	
   172		return 0;
   173	
   174	 out_lpc:
   175		release_region(lpcctl, 4);
   176	 out_ior:
   177		iounmap(chip->IO_ADDR_R);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index 63fcb8c..e928549 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -112,8 +112,7 @@  static int pasemi_nand_probe(struct platform_device *ofdev)
 	/* Allocate memory for MTD device structure and private data */
 	chip = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
 	if (!chip) {
-		printk(KERN_WARNING
-		       "Unable to allocate PASEMI NAND MTD device structure\n");
+		pr_warn("Unable to allocate PASEMI NAND MTD device structure\n");
 		err = -ENOMEM;
 		goto out;
 	}
@@ -163,13 +162,13 @@  static int pasemi_nand_probe(struct platform_device *ofdev)
 	}
 
 	if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
-		printk(KERN_ERR "pasemi_nand: Unable to register MTD device\n");
+		pr_err("pasemi_nand: Unable to register MTD device\n");
 		err = -ENODEV;
 		goto out_lpc;
 	}
 
-	printk(KERN_INFO "PA Semi NAND flash at %08llx, control at I/O %x\n",
-	       res.start, lpcctl);
+	pr_info("PA Semi NAND flash at %08zx, control at I/O %x\n", res.start,
+		lpcctl);
 
 	return 0;