Re: [PATCH 2/2] clocksource/drivers: Add Realtek Otto timer driver

From: kernel test robot
Date: Mon Jan 17 2022 - 02:38:49 EST


Hi Sander,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20220116]
[cannot apply to tip/timers/core linux/master linus/master daniel-lezcano/clockevents/next v5.16 v5.16-rc8 v5.16-rc7 v5.16]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Sander-Vanheule/Realtek-Otto-timer-counter-support/20220117-054003
base: 70e6f1b39929bf6755a9c55b79fe720f7c8b9436
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20220117/202201171557.EmiIHtdJ-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1c346209c6655c06ab28df22f821ffa06a792a14
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sander-Vanheule/Realtek-Otto-timer-counter-support/20220117-054003
git checkout 1c346209c6655c06ab28df22f821ffa06a792a14
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

drivers/clocksource/timer-realtek-otto.c: In function 'otto_tc_init':
>> drivers/clocksource/timer-realtek-otto.c:182:16: error: implicit declaration of function 'kzalloc'; did you mean 'd_alloc'? [-Werror=implicit-function-declaration]
182 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
| ^~~~~~~
| d_alloc
drivers/clocksource/timer-realtek-otto.c:182:14: warning: assignment to 'struct otto_tc_ctrl *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
182 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
| ^
>> drivers/clocksource/timer-realtek-otto.c:212:9: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
212 | kfree(ctrl);
| ^~~~~
cc1: some warnings being treated as errors


vim +182 drivers/clocksource/timer-realtek-otto.c

176
177 static int __init otto_tc_init(struct device_node *node)
178 {
179 struct otto_tc_ctrl *ctrl;
180 int err;
181
> 182 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
183 if (!ctrl)
184 return -ENOMEM;
185
186 spin_lock_init(&ctrl->lock);
187
188 ctrl->to.flags = TIMER_OF_BASE | TIMER_OF_IRQ | TIMER_OF_CLOCK;
189 ctrl->to.of_clk.name = "bus";
190 ctrl->to.of_irq.flags = IRQF_TIMER;
191 ctrl->to.of_irq.handler = otto_tc_handler;
192
193 err = timer_of_init(node, &ctrl->to);
194 if (err)
195 goto err_out;
196
197 /* Reset timer state */
198 writel(0, OTTO_TC_REG_CTL(&ctrl->to));
199 writel(0, OTTO_TC_REG_DATA(&ctrl->to));
200
201 /* TODO Replace by a real derived clock */
202 otto_tc_set_divisor(ctrl, OTTO_TC_MIN_DIVISOR);
203 ctrl->to.of_clk.rate /= OTTO_TC_MIN_DIVISOR;
204 ctrl->to.of_clk.period /= OTTO_TC_MIN_DIVISOR;
205
206 otto_tc_irq_enable_clear(&ctrl->to);
207 otto_tc_init_clkevt(&ctrl->to);
208
209 return 0;
210
211 err_out:
> 212 kfree(ctrl);

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