Skip to contentSkip to conversation

mtd: onenand: omap2: print resource using %pR format string

PATCH Applied Arnd Bergmann 4 participants 4 messages Jan 16, 2018 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: onenand: omap2: print resource using %pR format string

The omap2 onenand driver is now available for compile-testing, which uncovers a warning in configurations that have a 64-bit resource_size_t:

drivers/mtd/onenand/omap2.c: In function 'omap2_onenand_probe':
drivers/mtd/onenand/omap2.c:536:54: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]
dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
drivers/mtd/onenand/omap2.c:536:66: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Changing the format string to the special %pR simplifies the code and lets it do the right thing in that configuration, while avoiding the warning.

Fixes a758f50f10cf ("mtd: onenand: omap2: Configure driver from DT")
---
 drivers/mtd/onenand/omap2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +1 -2
index 2ce73fb6da1c..a4a2159bcfb7 100644
@@ -533,8 +533,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 
 	c->onenand.base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(c->onenand.base)) {
-		dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
-			res->start, resource_size(res));
+		dev_err(dev, "Cannot reserve memory region %pR\n", res);
 		return PTR_ERR(c->onenand.base);
 	}
 
Signature · 5 lines
2.9.0



Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 8 lines · Arnd Bergmann

The omap2 onenand driver is now available for compile-testing, which uncovers a warning in configurations that have a 64-bit resource_size_t:

drivers/mtd/onenand/omap2.c: In function 'omap2_onenand_probe':
drivers/mtd/onenand/omap2.c:536:54: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]
dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
drivers/mtd/onenand/omap2.c:536:66: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Quoted 6 lines

Changing the format string to the special %pR simplifies the code and lets it do the right thing in that configuration, while avoiding the warning.

Fixes a758f50f10cf ("mtd: onenand: omap2: Configure driver from DT")

-- Sebastian

Quoted 21 lines
---
 drivers/mtd/onenand/omap2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +1 -2
index 2ce73fb6da1c..a4a2159bcfb7 100644
@@ -533,8 +533,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 
 	c->onenand.base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(c->onenand.base)) {
-		dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
-			res->start, resource_size(res));
+		dev_err(dev, "Cannot reserve memory region %pR\n", res);
 		return PTR_ERR(c->onenand.base);
 	}
 
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

The omap2 onenand driver is now available for compile-testing, which uncovers a warning in configurations that have a 64-bit resource_size_t:

drivers/mtd/onenand/omap2.c: In function 'omap2_onenand_probe':
drivers/mtd/onenand/omap2.c:536:54: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]
dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
drivers/mtd/onenand/omap2.c:536:66: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Changing the format string to the special %pR simplifies the code and lets it do the right thing in that configuration, while avoiding the warning.

Quoted 12 lines
Fixes a758f50f10cf ("mtd: onenand: omap2: Configure driver from DT")
---
 drivers/mtd/onenand/omap2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +0 -0
index 2ce73fb6da1c..a4a2159bcfb7 100644

drivers/mtd/onenand/omap2.c static int omap2_onenand_probe(struct platform_device *pdev) · line 539

Quoted 9 lines
drivers/mtd/onenand/omap2.c +1 -2
@@ -533,8 +533,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 
 	c->onenand.base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(c->onenand.base)) {
-		dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
-			res->start, resource_size(res));
+		dev_err(dev, "Cannot reserve memory region %pR\n", res);
 		return PTR_ERR(c->onenand.base);
 	}
 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#3 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · On Tue, 16 Jan 2018 08:43:40 +0100 Arnd Bergmann <[email protected]> wrote:

The omap2 onenand driver is now available for compile-testing, which uncovers a warning in configurations that have a 64-bit resource_size_t:

drivers/mtd/onenand/omap2.c: In function 'omap2_onenand_probe':
drivers/mtd/onenand/omap2.c:536:54: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]
dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
drivers/mtd/onenand/omap2.c:536:66: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Changing the format string to the special %pR simplifies the code and lets it do the right thing in that configuration, while avoiding the warning.

Applied. I'll adjust my PR to include this fix.

Thanks,

Boris

Quoted 20 lines
Fixes a758f50f10cf ("mtd: onenand: omap2: Configure driver from DT")
---
 drivers/mtd/onenand/omap2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +1 -2
index 2ce73fb6da1c..a4a2159bcfb7 100644
@@ -533,8 +533,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
 
 	c->onenand.base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(c->onenand.base)) {
-		dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
-			res->start, resource_size(res));
+		dev_err(dev, "Cannot reserve memory region %pR\n", res);
 		return PTR_ERR(c->onenand.base);
 	}