drivers/irqchip/irq-renesas-rzg2l.c:342:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Mon Sep 27 2021 - 18:50:38 EST


tree: https://github.com/0day-ci/linux/commits/Lad-Prabhakar/Renesas-RZ-G2L-IRQC-support/20210922-114225
head: 148cc816430df44e59684c9d9d841517efebdd02
commit: 677e0107f5560d5ba18fd415e6afe7f4372c704f irqchip: Add RZ/G2L IA55 Interrupt Controller driver
date: 6 days ago
config: arm64-randconfig-r012-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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/677e0107f5560d5ba18fd415e6afe7f4372c704f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lad-Prabhakar/Renesas-RZ-G2L-IRQC-support/20210922-114225
git checkout 677e0107f5560d5ba18fd415e6afe7f4372c704f
# 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/irqchip/irq-renesas-rzg2l.c:342:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!priv->irq_domain) {
^~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:352:9: note: uninitialized use occurs here
return ret;
^~~
drivers/irqchip/irq-renesas-rzg2l.c:342:2: note: remove the 'if' if its condition is always true
if (!priv->irq_domain) {
^~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:293:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
>> drivers/irqchip/irq-renesas-rzg2l.c:307:6: warning: variable 'parent_irq_domain' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (gic_node)
^~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:310:7: note: uninitialized use occurs here
if (!parent_irq_domain) {
^~~~~~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:307:2: note: remove the 'if' if its condition is always true
if (gic_node)
^~~~~~~~~~~~~
drivers/irqchip/irq-renesas-rzg2l.c:287:38: note: initialize the variable 'parent_irq_domain' to silence this warning
struct irq_domain *parent_irq_domain;
^
= NULL
2 warnings generated.


vim +342 drivers/irqchip/irq-renesas-rzg2l.c

284
285 static int rzg2l_irqc_probe(struct platform_device *pdev)
286 {
287 struct irq_domain *parent_irq_domain;
288 struct device *dev = &pdev->dev;
289 struct device_node *np = dev->of_node;
290 struct device_node *gic_node;
291 struct rzg2l_irqc_priv *priv;
292 unsigned int i;
293 int ret;
294
295 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
296 if (!priv)
297 return -ENOMEM;
298
299 platform_set_drvdata(pdev, priv);
300 priv->dev = dev;
301
302 priv->base = devm_platform_ioremap_resource(pdev, 0);
303 if (IS_ERR(priv->base))
304 return PTR_ERR(priv->base);
305
306 gic_node = of_irq_find_parent(np);
> 307 if (gic_node)
308 parent_irq_domain = irq_find_host(gic_node);
309
310 if (!parent_irq_domain) {
311 dev_err(dev, "cannot find parent domain\n");
312 ret = -ENODEV;
313 goto out_put_node;
314 }
315
316 for (i = 0; i < IRQC_NUM_IRQ; i++) {
317 priv->irq[i] = platform_get_resource(pdev, IORESOURCE_IRQ, i);
318 if (!priv->irq[i]) {
319 ret = -ENOENT;
320 dev_err(dev, "failed to get irq resource(%u)", i);
321 goto out_put_node;
322 }
323 }
324
325 mutex_init(&priv->irqc_mutex);
326 mutex_init(&priv->tint_mutex);
327 pm_runtime_enable(&pdev->dev);
328 pm_runtime_resume_and_get(&pdev->dev);
329
330 priv->chip.name = "rzg2l-irqc";
331 priv->chip.irq_mask = irq_chip_mask_parent;
332 priv->chip.irq_unmask = irq_chip_unmask_parent;
333 priv->chip.irq_enable = rzg2l_irqc_irq_enable;
334 priv->chip.irq_disable = rzg2l_irqc_irq_disable;
335 priv->chip.irq_retrigger = irq_chip_retrigger_hierarchy;
336 priv->chip.irq_set_type = rzg2l_irqc_set_type;
337 priv->chip.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE;
338 priv->irq_domain = irq_domain_add_hierarchy(parent_irq_domain, 0,
339 IRQC_NUM_IRQ, np,
340 &rzg2l_irqc_domain_ops,
341 priv);
> 342 if (!priv->irq_domain) {
343 dev_err(dev, "cannot initialize irq domain\n");
344 ret = -ENOMEM;
345 pm_runtime_put(&pdev->dev);
346 pm_runtime_disable(&pdev->dev);
347 goto out_put_node;
348 }
349
350 out_put_node:
351 of_node_put(gic_node);
352 return ret;
353 }
354

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

Attachment: .config.gz
Description: application/gzip