diff mbox series

pinctrl: fix a discarded-qualifiers build error

Message ID 20220125175457.23728-1-miles.chen@mediatek.com (mailing list archive)
State New, archived
Headers show
Series pinctrl: fix a discarded-qualifiers build error | expand

Commit Message

Miles Chen Jan. 25, 2022, 5:54 p.m. UTC
Fix COMPILER=gcc ARCH=arm64 DEFCONFIG=allyesconfig build:

log:
drivers/pinctrl/pinctrl-thunderbay.c:815:29: error: assignment discards
'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

Fixes: 12422af8194d ("pinctrl: Add Intel Thunder Bay pinctrl driver")
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
---
 drivers/pinctrl/pinctrl-thunderbay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Laight Jan. 25, 2022, 10:17 p.m. UTC | #1
From: Miles Chen
> Sent: 25 January 2022 17:55
> 
> Fix COMPILER=gcc ARCH=arm64 DEFCONFIG=allyesconfig build:
> 
> log:
> drivers/pinctrl/pinctrl-thunderbay.c:815:29: error: assignment discards
> 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> 
> Fixes: 12422af8194d ("pinctrl: Add Intel Thunder Bay pinctrl driver")
> Signed-off-by: Miles Chen <miles.chen@mediatek.com>
> ---
>  drivers/pinctrl/pinctrl-thunderbay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-thunderbay.c b/drivers/pinctrl/pinctrl-thunderbay.c
> index b5b47f4dd774..4e6d718c03fc 100644
> --- a/drivers/pinctrl/pinctrl-thunderbay.c
> +++ b/drivers/pinctrl/pinctrl-thunderbay.c
> @@ -812,7 +812,7 @@ static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct funct
>  				}
>  			}
> 
> -			grp = func->group_names;
> +			grp = (const char **)func->group_names;

You should change the type of 'grp' not add a cast.
The compiler can warn about casts removing 'const' as well.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Miles Chen Jan. 26, 2022, 5:11 a.m. UTC | #2
Hi, 

> You should change the type of 'grp' not add a cast.
> The compiler can warn about casts removing 'const' as well.
> 
> 	David

Thanks for the comment,
I just found that this issue has been fixed [1]


Miles

[1] https://lore.kernel.org/lkml/DM6PR11MB3660804C821D7CA7329B6CAFC45F9@DM6PR11MB3660.namprd11.prod.outlook.com/
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-thunderbay.c b/drivers/pinctrl/pinctrl-thunderbay.c
index b5b47f4dd774..4e6d718c03fc 100644
--- a/drivers/pinctrl/pinctrl-thunderbay.c
+++ b/drivers/pinctrl/pinctrl-thunderbay.c
@@ -812,7 +812,7 @@  static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct funct
 				}
 			}
 
-			grp = func->group_names;
+			grp = (const char **)func->group_names;
 			while (*grp)
 				grp++;