Re: [PATCH 1/2] watchdog: Add watchdog driver for Sunplus SP7021

From: kernel test robot
Date: Sat Nov 20 2021 - 19:33:39 EST


Hi Xiantao,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pza/reset/next]
[also build test WARNING on robh/for-next linux/master linus/master v5.16-rc1 next-20211118]
[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/Xiantao-Hu/Add-watchdog-driver-for-Sunplus-SP7021-SoC/20211112-191201
base: https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-randconfig-r023-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/eac808eeed4a851ca5cfef12adefd6df199f62c2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xiantao-Hu/Add-watchdog-driver-for-Sunplus-SP7021-SoC/20211112-191201
git checkout eac808eeed4a851ca5cfef12adefd6df199f62c2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64

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

All warnings (new ones prefixed by >>):

>> drivers/watchdog/sunplus_wdt.c:191:27: warning: variable 'clk' is uninitialized when used here [-Wuninitialized]
err = clk_prepare_enable(clk);
^~~
drivers/watchdog/sunplus_wdt.c:178:17: note: initialize the variable 'clk' to silence this warning
struct clk *clk;
^
= NULL
1 warning generated.


vim +/clk +191 drivers/watchdog/sunplus_wdt.c

172
173 static int sp_wdt_probe(struct platform_device *pdev)
174 {
175 struct device *dev = &pdev->dev;
176 struct sp_wdt_priv *priv;
177 struct resource *wdt_res;
178 struct clk *clk;
179 int err;
180
181 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
182 if (!priv)
183 return -ENOMEM;
184
185 priv->clk = devm_clk_get(dev, NULL);
186 if (IS_ERR(priv->clk)) {
187 dev_err(dev, "Can't find clock source\n");
188 return PTR_ERR(priv->clk);
189 }
190
> 191 err = clk_prepare_enable(clk);
192 if (err) {
193 dev_err(dev, "Clock can't be enabled correctly\n");
194 return err;
195 }
196
197 priv->rstc = devm_reset_control_get_exclusive(dev, NULL);
198 if (!IS_ERR(priv->rstc))
199 reset_control_deassert(priv->rstc);
200
201 platform_set_drvdata(pdev, priv);
202
203 priv->base = devm_platform_ioremap_resource(pdev, 0);
204 if (IS_ERR(priv->base))
205 return PTR_ERR(priv->base);
206
207 wdt_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
208 priv->miscellaneous =
209 devm_ioremap(dev, wdt_res->start, resource_size(wdt_res));
210 if (IS_ERR(priv->miscellaneous))
211 return PTR_ERR(priv->miscellaneous);
212
213 priv->wdev.info = &sp_wdt_info;
214 priv->wdev.ops = &sp_wdt_ops;
215 priv->wdev.timeout = SP_WDT_MAX_TIMEOUT;
216 priv->wdev.max_timeout = SP_WDT_MAX_TIMEOUT;
217 priv->wdev.min_timeout = SP_WDT_MIN_TIMEOUT;
218 priv->wdev.parent = dev;
219
220 watchdog_set_drvdata(&priv->wdev, priv);
221 sp_wdt_hw_init(&priv->wdev);
222
223 watchdog_init_timeout(&priv->wdev, timeout, dev);
224 watchdog_set_nowayout(&priv->wdev, nowayout);
225 watchdog_stop_on_reboot(&priv->wdev);
226
227 err = devm_watchdog_register_device(dev, &priv->wdev);
228 if (unlikely(err))
229 return err;
230
231 dev_info(dev, "Watchdog enabled (timeout=%d sec%s.)\n",
232 priv->wdev.timeout, nowayout ? ", nowayout" : "");
233
234 return 0;
235 }
236

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

Attachment: .config.gz
Description: application/gzip