Re: [PATCH v2 2/2] irqchip: Add Qualcomm MPM controller driver

From: kernel test robot
Date: Sat Nov 27 2021 - 02:54:30 EST


Hi Shawn,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/irq/core]
[also build test WARNING on robh/for-next v5.16-rc2 next-20211126]
[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/Shawn-Guo/Add-Qualcomm-MPM-irqchip-driver-support/20211126-174350
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 2258a6fc33d56227a981a45069fc651d85a0076f
config: arm64-buildonly-randconfig-r006-20211126 (https://download.01.org/0day-ci/archive/20211127/202111271507.zYc4AvpT-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5162b558d8c0b542e752b037e72a69d5fd51eb1e)
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/c6f0c60a2d210e09a08be7a8f6e64d291fc708fd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shawn-Guo/Add-Qualcomm-MPM-irqchip-driver-support/20211126-174350
git checkout c6f0c60a2d210e09a08be7a8f6e64d291fc708fd
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/iio/ drivers/irqchip/ drivers/spi/

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/qcom-mpm.c:389:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!mpm_gpio_domain) {
^~~~~~~~~~~~~~~~
drivers/irqchip/qcom-mpm.c:422:9: note: uninitialized use occurs here
return ret;
^~~
drivers/irqchip/qcom-mpm.c:389:2: note: remove the 'if' if its condition is always false
if (!mpm_gpio_domain) {
^~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/qcom-mpm.c:343:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +389 drivers/irqchip/qcom-mpm.c

333
334 static int qcom_mpm_probe(struct platform_device *pdev)
335 {
336 struct irq_domain *parent_domain, *mpm_gic_domain, *mpm_gpio_domain;
337 struct device *dev = &pdev->dev;
338 struct device_node *np = dev->of_node;
339 struct device_node *parent = of_irq_find_parent(np);
340 struct qcom_mpm_priv *priv;
341 unsigned int pin_num;
342 int irq;
343 int ret;
344
345 /* See comments in platform_irqchip_probe() */
346 if (parent && !irq_find_matching_host(parent, DOMAIN_BUS_ANY))
347 return -EPROBE_DEFER;
348
349 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
350 if (!priv)
351 return -ENOMEM;
352
353 priv->data = of_device_get_match_data(dev);
354 if (!priv->data)
355 return -ENODEV;
356
357 pin_num = priv->data->pin_num;
358 priv->pin_to_irq = devm_kcalloc(dev, pin_num, sizeof(*priv->pin_to_irq),
359 GFP_KERNEL);
360 if (!priv)
361 return -ENOMEM;
362
363 priv->reg_stride = DIV_ROUND_UP(pin_num, 32);
364 spin_lock_init(&priv->lock);
365
366 priv->base = devm_platform_ioremap_resource(pdev, 0);
367 if (!priv->base)
368 return PTR_ERR(priv->base);
369
370 irq = platform_get_irq(pdev, 0);
371 if (irq < 0)
372 return irq;
373
374 parent_domain = irq_find_host(parent);
375 if (!parent_domain) {
376 dev_err(dev, "failed to find MPM parent domain\n");
377 return -ENXIO;
378 }
379
380 mpm_gic_domain = irq_domain_create_hierarchy(parent_domain, 0, pin_num,
381 of_node_to_fwnode(np), &qcom_mpm_gic_ops, priv);
382 if (!mpm_gic_domain) {
383 dev_err(dev, "failed to create GIC domain\n");
384 return -ENOMEM;
385 }
386
387 mpm_gpio_domain = irq_domain_create_linear(of_node_to_fwnode(np),
388 pin_num, &qcom_mpm_gpio_ops, priv);
> 389 if (!mpm_gpio_domain) {
390 dev_err(dev, "failed to create GPIO domain\n");
391 goto remove_gic_domain;
392 }
393
394 irq_domain_update_bus_token(mpm_gpio_domain, DOMAIN_BUS_WAKEUP);
395
396 priv->mbox_client.dev = dev;
397 priv->mbox_chan = mbox_request_channel(&priv->mbox_client, 0);
398 if (IS_ERR(priv->mbox_chan)) {
399 ret = PTR_ERR(priv->mbox_chan);
400 dev_err(dev, "failed to acquire IPC channel: %d\n", ret);
401 goto remove_gpio_domain;
402 }
403
404 ret = devm_request_irq(dev, irq, qcom_mpm_handler,
405 IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
406 "qcom_mpm", priv);
407 if (ret) {
408 dev_err(dev, "failed to request irq: %d\n", ret);
409 goto free_mbox;
410 }
411
412 dev_set_drvdata(dev, priv);
413
414 return 0;
415
416 free_mbox:
417 mbox_free_channel(priv->mbox_chan);
418 remove_gpio_domain:
419 irq_domain_remove(mpm_gpio_domain);
420 remove_gic_domain:
421 irq_domain_remove(mpm_gic_domain);
422 return ret;
423 }
424

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