Re: [PATCH v16 5/5] remoteproc: Add initial zynqmp R5 remoteproc driver

From: kernel test robot
Date: Thu Oct 01 2020 - 07:33:23 EST


Hi Ben,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.9-rc7 next-20200930]
[cannot apply to xlnx/master linux/master]
[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/Ben-Levinsky/Provide-basic-driver-to-control-Arm-R5-co-processor-found-on-Xilinx-ZynqMP/20200923-064055
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm64-randconfig-r005-20200930 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bcd05599d0e53977a963799d6ee4f6e0bc21331b)
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/d3c4821ffb9b295e80f07fd712322efa657a95d9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ben-Levinsky/Provide-basic-driver-to-control-Arm-R5-co-processor-found-on-Xilinx-ZynqMP/20200923-064055
git checkout d3c4821ffb9b295e80f07fd712322efa657a95d9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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/remoteproc/zynqmp_r5_remoteproc.c:630:2: warning: variable 'dev' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!pdata) {
^~~~~~~~~~~
include/linux/compiler.h:56:28: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/remoteproc/zynqmp_r5_remoteproc.c:686:20: note: uninitialized use occurs here
device_unregister(dev);
^~~
drivers/remoteproc/zynqmp_r5_remoteproc.c:630:2: note: remove the 'if' if its condition is always false
if (!pdata) {
^~~~~~~~~~~~~
include/linux/compiler.h:56:23: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^
drivers/remoteproc/zynqmp_r5_remoteproc.c:625:20: note: initialize the variable 'dev' to silence this warning
struct device *dev;
^
= NULL
1 warning generated.

vim +630 drivers/remoteproc/zynqmp_r5_remoteproc.c

610
611 /**
612 * zynqmp_r5_probe() - Probes ZynqMP R5 processor device node
613 * @pdata: pointer to the ZynqMP R5 processor platform data
614 * @pdev: parent RPU domain platform device
615 * @node: pointer of the device node
616 *
617 * Function to retrieve the information of the ZynqMP R5 device node.
618 *
619 * Return: 0 for success, negative value for failure.
620 */
621 static int zynqmp_r5_probe(struct zynqmp_r5_pdata *pdata,
622 struct platform_device *pdev,
623 struct device_node *node)
624 {
625 struct device *dev;
626 struct rproc *rproc;
627 int ret;
628
629 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
> 630 if (!pdata) {
631 ret = -ENOMEM;
632 goto error;
633 }
634 dev = &pdata->dev;
635
636 /* Create device for ZynqMP R5 device */
637 dev->parent = &pdev->dev;
638 dev->release = zynqmp_r5_release;
639 dev->of_node = node;
640 dev_set_name(dev, "%pOF", node);
641 dev_set_drvdata(dev, pdata);
642 ret = device_register(dev);
643 if (ret)
644 goto error;
645
646 /* Allocate remoteproc instance */
647 rproc = rproc_alloc(dev, dev_name(dev), &zynqmp_r5_rproc_ops, NULL, sizeof(*pdata));
648 if (!rproc) {
649 ret = -ENOMEM;
650 goto error;
651 }
652 pdata->rproc = rproc;
653 rproc->priv = pdata;
654
655 /* Set up DMA mask */
656 ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
657 if (ret)
658 goto error;
659
660 /* Get R5 power domain node */
661 ret = of_property_read_u32(node, "pnode-id", &pdata->pnode_id);
662 if (ret)
663 goto error;
664
665 ret = r5_set_mode(pdata);
666 if (ret)
667 goto error;
668
669 if (of_property_read_bool(node, "mboxes")) {
670 ret = zynqmp_r5_setup_mbox(pdata, node);
671 if (ret)
672 goto error;
673 }
674
675 /* Add R5 remoteproc */
676 ret = rproc_add(rproc);
677 if (ret)
678 goto error;
679
680 platform_set_drvdata(pdev, rproc);
681 return 0;
682 error:
683 if (pdata->rproc)
684 rproc_free(pdata->rproc);
685 pdata->rproc = NULL;
686 device_unregister(dev);
687 return ret;
688 }
689

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

Attachment: .config.gz
Description: application/gzip