Re: [PATCH v2 02/16] soc: qcom: apr: make code more reuseable

From: kernel test robot
Date: Wed Jul 14 2021 - 16:37:24 EST


Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on robh/for-next sound/for-next linus/master v5.14-rc1 next-20210714]
[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/Srinivas-Kandagatla/ASoC-qcom-Add-AudioReach-support/20210714-233339
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: mips-randconfig-r004-20210714 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/16cc55dede1767dd253072173a72dcc8c7a88a34
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Srinivas-Kandagatla/ASoC-qcom-Add-AudioReach-support/20210714-233339
git checkout 16cc55dede1767dd253072173a72dcc8c7a88a34
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

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/soc/qcom/apr.c:446:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (of_device_is_compatible(dev->of_node, "qcom,apr")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/soc/qcom/apr.c:451:6: note: uninitialized use occurs here
if (ret) {
^~~
drivers/soc/qcom/apr.c:446:2: note: remove the 'if' if its condition is always true
if (of_device_is_compatible(dev->of_node, "qcom,apr")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/soc/qcom/apr.c:440:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +446 drivers/soc/qcom/apr.c

435
436 static int apr_probe(struct rpmsg_device *rpdev)
437 {
438 struct device *dev = &rpdev->dev;
439 struct packet_router *apr;
440 int ret;
441
442 apr = devm_kzalloc(dev, sizeof(*apr), GFP_KERNEL);
443 if (!apr)
444 return -ENOMEM;
445
> 446 if (of_device_is_compatible(dev->of_node, "qcom,apr")) {
447 ret = of_property_read_u32(dev->of_node, "qcom,apr-domain", &apr->dest_domain_id);
448 apr->type = PR_TYPE_APR;
449 }
450
451 if (ret) {
452 dev_err(dev, "Domain ID not specified in DT\n");
453 return ret;
454 }
455
456 dev_set_drvdata(dev, apr);
457 apr->ch = rpdev->ept;
458 apr->dev = dev;
459 apr->rxwq = create_singlethread_workqueue("qcom_apr_rx");
460 if (!apr->rxwq) {
461 dev_err(apr->dev, "Failed to start Rx WQ\n");
462 return -ENOMEM;
463 }
464 INIT_WORK(&apr->rx_work, apr_rxwq);
465
466 apr->pdr = pdr_handle_alloc(apr_pd_status, apr);
467 if (IS_ERR(apr->pdr)) {
468 dev_err(dev, "Failed to init PDR handle\n");
469 ret = PTR_ERR(apr->pdr);
470 goto destroy_wq;
471 }
472
473 INIT_LIST_HEAD(&apr->rx_list);
474 spin_lock_init(&apr->rx_lock);
475 spin_lock_init(&apr->svcs_lock);
476 idr_init(&apr->svcs_idr);
477
478 ret = of_apr_add_pd_lookups(dev);
479 if (ret)
480 goto handle_release;
481
482 of_register_apr_devices(dev, NULL);
483
484 return 0;
485
486 handle_release:
487 pdr_handle_release(apr->pdr);
488 destroy_wq:
489 destroy_workqueue(apr->rxwq);
490 return ret;
491 }
492

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

Attachment: .config.gz
Description: application/gzip