]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: renesas: Fix register usage in sh_pfc_{read,write}
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Tue, 19 Jun 2018 04:13:42 +0000 (06:13 +0200)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Tue, 19 Jun 2018 04:15:55 +0000 (06:15 +0200)
The sh_pfc_{read,write}() must operate on the register address directly
rather than on an offset, fix this to prevent illegal access.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
drivers/pinctrl/renesas/pfc.c

index 6aa2e13f3ecfebe40707c2016689b307b4d1a909..90011537a856444863c6f5538c047bc037fa9879 100644 (file)
@@ -121,7 +121,7 @@ void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width,
 
 u32 sh_pfc_read(struct sh_pfc *pfc, u32 reg)
 {
-       return sh_pfc_read_raw_reg(pfc->regs + reg, 32);
+       return sh_pfc_read_raw_reg((void __iomem *)(uintptr_t)reg, 32);
 }
 
 void sh_pfc_write(struct sh_pfc *pfc, u32 reg, u32 data)
@@ -132,7 +132,7 @@ void sh_pfc_write(struct sh_pfc *pfc, u32 reg, u32 data)
        if (pfc->info->unlock_reg)
                sh_pfc_write_raw_reg(unlock_reg, 32, ~data);
 
-       sh_pfc_write_raw_reg(pfc->regs + reg, 32, data);
+       sh_pfc_write_raw_reg((void __iomem *)(uintptr_t)reg, 32, data);
 }
 
 static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,