diff mbox series

pinctrl: loongson2: Fix some const correctness

Message ID 20221125104038.7638-1-linus.walleij@linaro.org
State Accepted
Commit 7ebfe10ec36b80637fe746dc2371ff1d9ce71efa
Headers show
Series pinctrl: loongson2: Fix some const correctness | expand

Commit Message

Linus Walleij Nov. 25, 2022, 10:40 a.m. UTC
The kernel robot using sparse is complaining like this:

drivers/pinctrl/pinctrl-loongson2.c:212:21: sparse:
 sparse: incorrect type in argument 1 (different address spaces) @@
 expected void const volatile [noderef] __iomem *addr @@
 got void *[noderef] __iomem reg @@
(...)

I think the problem is simply that the register base is defined
as void * __iomem instead of void __iomem * and this is because
of the way const correctness works with pointer infix order.

Fix it up. I think.

Cc: zhanghongchen <zhanghongchen@loongson.cn>
Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
Fixes: f73f88acbc18 ("pinctrl: pinctrl-loongson2: add pinctrl driver support")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/pinctrl/pinctrl-loongson2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-loongson2.c b/drivers/pinctrl/pinctrl-loongson2.c
index 1e9ec87e6930..a72ffeca26fb 100644
--- a/drivers/pinctrl/pinctrl-loongson2.c
+++ b/drivers/pinctrl/pinctrl-loongson2.c
@@ -45,7 +45,7 @@  struct loongson2_pinctrl {
 	struct pinctrl_desc desc;
 	struct device_node *of_node;
 	spinlock_t lock;
-	void * __iomem reg_base;
+	void __iomem *reg_base;
 };
 
 struct loongson2_pmx_group {
@@ -202,7 +202,7 @@  static int loongson2_pmx_set_mux(struct pinctrl_dev *pcdev, unsigned int func_nu
 			      unsigned int group_num)
 {
 	struct loongson2_pinctrl *pctrl = pinctrl_dev_get_drvdata(pcdev);
-	void * __iomem reg = pctrl->reg_base +
+	void __iomem *reg = pctrl->reg_base +
 				loongson2_pmx_groups[group_num].reg;
 	unsigned int mux_bit = loongson2_pmx_groups[group_num].bit;
 	unsigned int val;