drivers/clk/samsung/clk-exynos-clkout.c:188:23: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Dec 26 2020 - 21:59:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: 124f035310adc781d91cdf0b7c6e4fb3c7e43e23 clk: samsung: allow building the clkout driver as module
date: 6 weeks ago
config: openrisc-randconfig-s032-20201221 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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.3-184-g1b896707-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=124f035310adc781d91cdf0b7c6e4fb3c7e43e23
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 124f035310adc781d91cdf0b7c6e4fb3c7e43e23
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc

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/clk/samsung/clk-exynos-clkout.c:188:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *reg @@
drivers/clk/samsung/clk-exynos-clkout.c:188:23: sparse: expected void *addr
drivers/clk/samsung/clk-exynos-clkout.c:188:23: sparse: got void [noderef] __iomem *reg
drivers/clk/samsung/clk-exynos-clkout.c:205:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *reg @@
drivers/clk/samsung/clk-exynos-clkout.c:205:23: sparse: expected void *addr
drivers/clk/samsung/clk-exynos-clkout.c:205:23: sparse: got void [noderef] __iomem *reg

vim +188 drivers/clk/samsung/clk-exynos-clkout.c

9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 102
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 103 static int exynos_clkout_probe(struct platform_device *pdev)
1e832e51018e960 Tomasz Figa 2014-06-24 104 {
1e832e51018e960 Tomasz Figa 2014-06-24 105 const char *parent_names[EXYNOS_CLKOUT_PARENTS];
1e832e51018e960 Tomasz Figa 2014-06-24 106 struct clk *parents[EXYNOS_CLKOUT_PARENTS];
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 107 struct exynos_clkout *clkout;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 108 int parent_count, ret, i;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 109 u32 mux_mask;
1e832e51018e960 Tomasz Figa 2014-06-24 110
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 111 clkout = devm_kzalloc(&pdev->dev,
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 112 struct_size(clkout, data.hws, EXYNOS_CLKOUT_NR_CLKS),
cf1395143f0ee68 Marek Szyprowski 2017-04-24 113 GFP_KERNEL);
1e832e51018e960 Tomasz Figa 2014-06-24 114 if (!clkout)
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 115 return -ENOMEM;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 116
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 117 ret = exynos_clkout_match_parent_dev(&pdev->dev, &mux_mask);
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 118 if (ret)
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 119 return ret;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 120
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 121 clkout->np = pdev->dev.of_node;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 122 if (!clkout->np) {
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 123 /*
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 124 * pdev->dev.parent was checked by exynos_clkout_match_parent_dev()
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 125 * so it is not NULL.
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 126 */
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 127 clkout->np = pdev->dev.parent->of_node;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 128 }
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 129
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 130 platform_set_drvdata(pdev, clkout);
1e832e51018e960 Tomasz Figa 2014-06-24 131
1e832e51018e960 Tomasz Figa 2014-06-24 132 spin_lock_init(&clkout->slock);
1e832e51018e960 Tomasz Figa 2014-06-24 133
1e832e51018e960 Tomasz Figa 2014-06-24 134 parent_count = 0;
1e832e51018e960 Tomasz Figa 2014-06-24 135 for (i = 0; i < EXYNOS_CLKOUT_PARENTS; ++i) {
1e832e51018e960 Tomasz Figa 2014-06-24 136 char name[] = "clkoutXX";
1e832e51018e960 Tomasz Figa 2014-06-24 137
1e832e51018e960 Tomasz Figa 2014-06-24 138 snprintf(name, sizeof(name), "clkout%d", i);
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 139 parents[i] = of_clk_get_by_name(clkout->np, name);
1e832e51018e960 Tomasz Figa 2014-06-24 140 if (IS_ERR(parents[i])) {
1e832e51018e960 Tomasz Figa 2014-06-24 141 parent_names[i] = "none";
1e832e51018e960 Tomasz Figa 2014-06-24 142 continue;
1e832e51018e960 Tomasz Figa 2014-06-24 143 }
1e832e51018e960 Tomasz Figa 2014-06-24 144
1e832e51018e960 Tomasz Figa 2014-06-24 145 parent_names[i] = __clk_get_name(parents[i]);
1e832e51018e960 Tomasz Figa 2014-06-24 146 parent_count = i + 1;
1e832e51018e960 Tomasz Figa 2014-06-24 147 }
1e832e51018e960 Tomasz Figa 2014-06-24 148
1e832e51018e960 Tomasz Figa 2014-06-24 149 if (!parent_count)
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 150 return -EINVAL;
1e832e51018e960 Tomasz Figa 2014-06-24 151
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 152 clkout->reg = of_iomap(clkout->np, 0);
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 153 if (!clkout->reg) {
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 154 ret = -ENODEV;
1e832e51018e960 Tomasz Figa 2014-06-24 155 goto clks_put;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 156 }
1e832e51018e960 Tomasz Figa 2014-06-24 157
1e832e51018e960 Tomasz Figa 2014-06-24 158 clkout->gate.reg = clkout->reg + EXYNOS_PMU_DEBUG_REG;
1e832e51018e960 Tomasz Figa 2014-06-24 159 clkout->gate.bit_idx = EXYNOS_CLKOUT_DISABLE_SHIFT;
1e832e51018e960 Tomasz Figa 2014-06-24 160 clkout->gate.flags = CLK_GATE_SET_TO_DISABLE;
1e832e51018e960 Tomasz Figa 2014-06-24 161 clkout->gate.lock = &clkout->slock;
1e832e51018e960 Tomasz Figa 2014-06-24 162
1e832e51018e960 Tomasz Figa 2014-06-24 163 clkout->mux.reg = clkout->reg + EXYNOS_PMU_DEBUG_REG;
1e832e51018e960 Tomasz Figa 2014-06-24 164 clkout->mux.mask = mux_mask;
1e832e51018e960 Tomasz Figa 2014-06-24 165 clkout->mux.shift = EXYNOS_CLKOUT_MUX_SHIFT;
1e832e51018e960 Tomasz Figa 2014-06-24 166 clkout->mux.lock = &clkout->slock;
1e832e51018e960 Tomasz Figa 2014-06-24 167
cf1395143f0ee68 Marek Szyprowski 2017-04-24 168 clkout->data.hws[0] = clk_hw_register_composite(NULL, "clkout",
1e832e51018e960 Tomasz Figa 2014-06-24 169 parent_names, parent_count, &clkout->mux.hw,
1e832e51018e960 Tomasz Figa 2014-06-24 170 &clk_mux_ops, NULL, NULL, &clkout->gate.hw,
1e832e51018e960 Tomasz Figa 2014-06-24 171 &clk_gate_ops, CLK_SET_RATE_PARENT
1e832e51018e960 Tomasz Figa 2014-06-24 172 | CLK_SET_RATE_NO_REPARENT);
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 173 if (IS_ERR(clkout->data.hws[0])) {
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 174 ret = PTR_ERR(clkout->data.hws[0]);
1e832e51018e960 Tomasz Figa 2014-06-24 175 goto err_unmap;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 176 }
1e832e51018e960 Tomasz Figa 2014-06-24 177
cf1395143f0ee68 Marek Szyprowski 2017-04-24 178 clkout->data.num = EXYNOS_CLKOUT_NR_CLKS;
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 179 ret = of_clk_add_hw_provider(clkout->np, of_clk_hw_onecell_get, &clkout->data);
1e832e51018e960 Tomasz Figa 2014-06-24 180 if (ret)
1e832e51018e960 Tomasz Figa 2014-06-24 181 goto err_clk_unreg;
1e832e51018e960 Tomasz Figa 2014-06-24 182
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 183 return 0;
1e832e51018e960 Tomasz Figa 2014-06-24 184
1e832e51018e960 Tomasz Figa 2014-06-24 185 err_clk_unreg:
cf1395143f0ee68 Marek Szyprowski 2017-04-24 186 clk_hw_unregister(clkout->data.hws[0]);
1e832e51018e960 Tomasz Figa 2014-06-24 187 err_unmap:
1e832e51018e960 Tomasz Figa 2014-06-24 @188 iounmap(clkout->reg);
1e832e51018e960 Tomasz Figa 2014-06-24 189 clks_put:
1e832e51018e960 Tomasz Figa 2014-06-24 190 for (i = 0; i < EXYNOS_CLKOUT_PARENTS; ++i)
1e832e51018e960 Tomasz Figa 2014-06-24 191 if (!IS_ERR(parents[i]))
1e832e51018e960 Tomasz Figa 2014-06-24 192 clk_put(parents[i]);
1e832e51018e960 Tomasz Figa 2014-06-24 193
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 194 dev_err(&pdev->dev, "failed to register clkout clock\n");
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 195
9484f2cb83327c4 Krzysztof Kozlowski 2020-10-01 196 return ret;
1e832e51018e960 Tomasz Figa 2014-06-24 197 }
1e832e51018e960 Tomasz Figa 2014-06-24 198

:::::: The code at line 188 was first introduced by commit
:::::: 1e832e51018e960ecfc6f04abb1cbdd1ed82b8cb clk: samsung: Add driver to control CLKOUT line on Exynos SoCs

:::::: TO: Tomasz Figa <t.figa@xxxxxxxxxxx>
:::::: CC: Tomasz Figa <t.figa@xxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip