drivers/watchdog/ixp4xx_wdt.c:122:20: sparse: sparse: incorrect type in assignment (different address spaces)

From: kernel test robot
Date: Fri Sep 10 2021 - 04:54:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bf9f243f23e6623f310ba03fbb14e10ec3a61290
commit: 21a0a29d16c672b0c6e3662ea55969dccdbc5547 watchdog: ixp4xx: Rewrite driver to use core
date: 5 weeks ago
config: arm-randconfig-s032-20210910 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=21a0a29d16c672b0c6e3662ea55969dccdbc5547
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 21a0a29d16c672b0c6e3662ea55969dccdbc5547
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/watchdog/ixp4xx_wdt.c:122:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *base @@ got void *platform_data @@
drivers/watchdog/ixp4xx_wdt.c:122:20: sparse: expected void [noderef] __iomem *base
drivers/watchdog/ixp4xx_wdt.c:122:20: sparse: got void *platform_data

vim +122 drivers/watchdog/ixp4xx_wdt.c

106
107 static int ixp4xx_wdt_probe(struct platform_device *pdev)
108 {
109 struct device *dev = &pdev->dev;
110 struct ixp4xx_wdt *iwdt;
111 struct clk *clk;
112 int ret;
113
114 if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) {
115 dev_err(dev, "Rev. A0 IXP42x CPU detected - watchdog disabled\n");
116 return -ENODEV;
117 }
118
119 iwdt = devm_kzalloc(dev, sizeof(*iwdt), GFP_KERNEL);
120 if (!iwdt)
121 return -ENOMEM;
> 122 iwdt->base = dev->platform_data;
123
124 /*
125 * Retrieve rate from a fixed clock from the device tree if
126 * the parent has that, else use the default clock rate.
127 */
128 clk = devm_clk_get(dev->parent, NULL);
129 if (!IS_ERR(clk)) {
130 ret = clk_prepare_enable(clk);
131 if (ret)
132 return ret;
133 ret = devm_add_action_or_reset(dev, ixp4xx_clock_action, clk);
134 if (ret)
135 return ret;
136 iwdt->rate = clk_get_rate(clk);
137 }
138 if (!iwdt->rate)
139 iwdt->rate = IXP4XX_TIMER_FREQ;
140
141 iwdt->wdd.info = &ixp4xx_wdt_info;
142 iwdt->wdd.ops = &ixp4xx_wdt_ops;
143 iwdt->wdd.min_timeout = 1;
144 iwdt->wdd.max_timeout = U32_MAX / iwdt->rate;
145 iwdt->wdd.parent = dev;
146 /* Default to 60 seconds */
147 iwdt->wdd.timeout = 60U;
148 watchdog_init_timeout(&iwdt->wdd, 0, dev);
149
150 if (__raw_readl(iwdt->base + IXP4XX_OSST_OFFSET) &
151 IXP4XX_OSST_TIMER_WARM_RESET)
152 iwdt->wdd.bootstatus = WDIOF_CARDRESET;
153
154 ret = devm_watchdog_register_device(dev, &iwdt->wdd);
155 if (ret)
156 return ret;
157
158 dev_info(dev, "IXP4xx watchdog available\n");
159
160 return 0;
161 }
162

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip