All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: sunplus: use %pap to print resource_size_t
@ 2022-11-20  0:39 Randy Dunlap
  2022-11-21 14:10 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2022-11-20  0:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Qin Jian, Arnd Bergmann, Vincent Shih,
	Alessandro Zummo, Alexandre Belloni, linux-rtc

Prevent a printk format warning by using %pap, which is designed for
this purpose and can handle any size of resource_size_t.

../drivers/rtc/rtc-sunplus.c: In function 'sp_rtc_probe':
../drivers/rtc/rtc-sunplus.c:243:33: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
  243 |         dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n",

Fixes: 0aa94eea8d95 ("ARM: sunplus: Add initial support for Sunplus SP7021 SoC")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Qin Jian <qinjian@cqplus1.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Vincent Shih <vincent.sunplus@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
---
 drivers/rtc/rtc-sunplus.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -- a/drivers/rtc/rtc-sunplus.c b/drivers/rtc/rtc-sunplus.c
--- a/drivers/rtc/rtc-sunplus.c
+++ b/drivers/rtc/rtc-sunplus.c
@@ -240,8 +240,8 @@ static int sp_rtc_probe(struct platform_
 	if (IS_ERR(sp_rtc->reg_base))
 		return dev_err_probe(&plat_dev->dev, PTR_ERR(sp_rtc->reg_base),
 					    "%s devm_ioremap_resource fail\n", RTC_REG_NAME);
-	dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n",
-		sp_rtc->res->start, (unsigned long)sp_rtc->reg_base);
+	dev_dbg(&plat_dev->dev, "res = 0x%pap, reg_base = 0x%lx\n",
+		&sp_rtc->res->start, (unsigned long)sp_rtc->reg_base);
 
 	sp_rtc->irq = platform_get_irq(plat_dev, 0);
 	if (sp_rtc->irq < 0)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: sunplus: use %pap to print resource_size_t
  2022-11-20  0:39 [PATCH] ARM: sunplus: use %pap to print resource_size_t Randy Dunlap
@ 2022-11-21 14:10 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2022-11-21 14:10 UTC (permalink / raw)
  To: Randy Dunlap, linux-kernel
  Cc: Qin Jian, Vincent Shih, Alessandro Zummo, Alexandre Belloni, linux-rtc

On Sun, Nov 20, 2022, at 01:39, Randy Dunlap wrote:
> Prevent a printk format warning by using %pap, which is designed for
> this purpose and can handle any size of resource_size_t.
>
> ../drivers/rtc/rtc-sunplus.c: In function 'sp_rtc_probe':
> ../drivers/rtc/rtc-sunplus.c:243:33: warning: format '%x' expects 
> argument of type 'unsigned int', but argument 4 has type 
> 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
>   243 |         dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 
> 0x%lx\n",
>
> Fixes: 0aa94eea8d95 ("ARM: sunplus: Add initial support for Sunplus SP7021 SoC")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Qin Jian <qinjian@cqplus1.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Vincent Shih <vincent.sunplus@gmail.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: linux-rtc@vger.kernel.org

Acked-by: Arnd Bergmann <arnd@arndb.de>

>  	if (IS_ERR(sp_rtc->reg_base))
>  		return dev_err_probe(&plat_dev->dev, PTR_ERR(sp_rtc->reg_base),
>  					    "%s devm_ioremap_resource fail\n", RTC_REG_NAME);
> -	dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n",
> -		sp_rtc->res->start, (unsigned long)sp_rtc->reg_base);
> +	dev_dbg(&plat_dev->dev, "res = 0x%pap, reg_base = 0x%lx\n",
> +		&sp_rtc->res->start, (unsigned long)sp_rtc->reg_base);
> 

I would have picked %pr to print the resource, but hsi works as well.

      Arnd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-21 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20  0:39 [PATCH] ARM: sunplus: use %pap to print resource_size_t Randy Dunlap
2022-11-21 14:10 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.