diff mbox series

[v2,1/2] pinctrl: nuvoton: npcm7xx: Use %zd printk format for ARRAY_SIZE()

Message ID 20220203133736.246397-2-j.neuschaefer@gmx.net
State Superseded
Headers show
Series Fixing the compile-test warnings in pinctrl-npcm7xx | expand

Commit Message

J. Neuschäfer Feb. 3, 2022, 1:37 p.m. UTC
When compile-testing on 64-bit architectures, GCC complains about the
mismatch of types between the %d format specifier and value returned by
ARRAY_LENGTH(). Use %zd, which is correct everywhere.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 3b588e43ee5c7 ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---

v2:
- Add Fixes and R-b tags
---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.34.1

Comments

Andy Shevchenko Feb. 3, 2022, 2:16 p.m. UTC | #1
On Thu, Feb 3, 2022 at 3:37 PM Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:
>
> When compile-testing on 64-bit architectures, GCC complains about the
> mismatch of types between the %d format specifier and value returned by
> ARRAY_LENGTH(). Use %zd, which is correct everywhere.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 3b588e43ee5c7 ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

...

> -       dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
> +       dev_dbg(npcm->dev, "group size: %zd\n", ARRAY_SIZE(npcm7xx_groups));

Dunno how it's slipped away, but the proper specifier is %zu. I guess
that's what I also mentioned in reply to LKP's report.
J. Neuschäfer Feb. 3, 2022, 2:40 p.m. UTC | #2
On Thu, Feb 03, 2022 at 04:16:56PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 3, 2022 at 3:37 PM Jonathan Neuschäfer
> <j.neuschaefer@gmx.net> wrote:
> >
> > When compile-testing on 64-bit architectures, GCC complains about the
> > mismatch of types between the %d format specifier and value returned by
> > ARRAY_LENGTH(). Use %zd, which is correct everywhere.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Fixes: 3b588e43ee5c7 ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> ...
> 
> > -       dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
> > +       dev_dbg(npcm->dev, "group size: %zd\n", ARRAY_SIZE(npcm7xx_groups));
> 
> Dunno how it's slipped away, but the proper specifier is %zu.

Right, I should have noticed that.

> I guess that's what I also mentioned in reply to LKP's report.

True,

>> Should be %zu


Thanks,
Jonathan
diff mbox series

Patch

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 4d81908d6725d..705576e03e334 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -1561,7 +1561,7 @@  static int npcm7xx_get_groups_count(struct pinctrl_dev *pctldev)
 {
 	struct npcm7xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev);

-	dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
+	dev_dbg(npcm->dev, "group size: %zd\n", ARRAY_SIZE(npcm7xx_groups));
 	return ARRAY_SIZE(npcm7xx_groups);
 }