Patchwork mtd: nand: fix printk() warnings

login
register
mail settings
Submitter Dan Carpenter
Date Jan. 31, 2012, 8:54 a.m.
Message ID <20120131085405.GD22039@elgon.mountain>
Download mbox | patch
Permalink /patch/138720/
State New
Headers show

Comments

Dan Carpenter - Jan. 31, 2012, 8:54 a.m.
Gcc complains here:
drivers/mtd/nand/docg4.c: In function ‘probe_docg4’:
drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘resource_size_t’ [-Wformat]
drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘resource_size_t’ [-Wformat]

We have a standard way of printing these using a format string
extension.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Randy.Dunlap - Jan. 31, 2012, 6:40 p.m.
On 01/31/2012 12:54 AM, Dan Carpenter wrote:
> Gcc complains here:
> drivers/mtd/nand/docg4.c: In function ‘probe_docg4’:
> drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘resource_size_t’ [-Wformat]
> drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘resource_size_t’ [-Wformat]
> 
> We have a standard way of printing these using a format string
> extension.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Yes, this is preferable over my patch yesterday.
Thanks.

Acked-by: Randy Dunlap <rdunlap@xenotime.net>

> 
> diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
> index 3ec1d10..8a0d7f6 100644
> --- a/drivers/mtd/nand/docg4.c
> +++ b/drivers/mtd/nand/docg4.c
> @@ -1272,9 +1272,7 @@ static int __init probe_docg4(struct platform_device *pdev)
>  
>  	virtadr = ioremap(r->start, resource_size(r));
>  	if (!virtadr) {
> -		dev_err(dev, "Diskonchip ioremap failed: "
> -			"0x%x bytes at 0x%x\n",
> -			resource_size(r), r->start);
> +		dev_err(dev, "Diskonchip ioremap failed: %pR\n", r);
>  		return -EIO;
>  	}
>  
> --
Artem Bityutskiy - Feb. 3, 2012, 9:16 a.m.
On Tue, 2012-01-31 at 11:54 +0300, Dan Carpenter wrote:
> Gcc complains here:
> drivers/mtd/nand/docg4.c: In function ‘probe_docg4’:
> drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘resource_size_t’ [-Wformat]
> drivers/mtd/nand/docg4.c:1277:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘resource_size_t’ [-Wformat]
> 
> We have a standard way of printing these using a format string
> extension.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to l2-mtd-2.6.git, thanks!

Patch

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index 3ec1d10..8a0d7f6 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -1272,9 +1272,7 @@  static int __init probe_docg4(struct platform_device *pdev)
 
 	virtadr = ioremap(r->start, resource_size(r));
 	if (!virtadr) {
-		dev_err(dev, "Diskonchip ioremap failed: "
-			"0x%x bytes at 0x%x\n",
-			resource_size(r), r->start);
+		dev_err(dev, "Diskonchip ioremap failed: %pR\n", r);
 		return -EIO;
 	}