Skip to content

Commit 0827946

Browse files
arndbalexandrebelloni
authored andcommitted
rtc: sunplus: fix format string for printing resource
On 32-bit architectures with 64-bit resource_size_t, sp_rtc_probe() causes a compiler warning: drivers/rtc/rtc-sunplus.c: In function 'sp_rtc_probe': drivers/rtc/rtc-sunplus.c:243:33: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=] 243 | dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The best way to print a resource is the special %pR format string, and similarly to print a pointer we can use %p and avoid the cast. Fixes: fad6cbe ("rtc: Add driver for RTC in Sunplus SP7021") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 51b3802 commit 0827946

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/rtc/rtc-sunplus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ static int sp_rtc_probe(struct platform_device *plat_dev)
240240
if (IS_ERR(sp_rtc->reg_base))
241241
return dev_err_probe(&plat_dev->dev, PTR_ERR(sp_rtc->reg_base),
242242
"%s devm_ioremap_resource fail\n", RTC_REG_NAME);
243-
dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n",
244-
sp_rtc->res->start, (unsigned long)sp_rtc->reg_base);
243+
dev_dbg(&plat_dev->dev, "res = %pR, reg_base = %p\n",
244+
sp_rtc->res, sp_rtc->reg_base);
245245

246246
sp_rtc->irq = platform_get_irq(plat_dev, 0);
247247
if (sp_rtc->irq < 0)

0 commit comments

Comments
 (0)