All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v5] pinctrl: qcom: sc8180x: add ACPI probe support
Date: Thu, 11 Mar 2021 11:51:04 +0800	[thread overview]
Message-ID: <202103111141.dqlOhB77-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6099 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210311024102.15450-1-shawn.guo@linaro.org>
References: <20210311024102.15450-1-shawn.guo@linaro.org>
TO: Shawn Guo <shawn.guo@linaro.org>
TO: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@linaro.org>
CC: Andy Shevchenko <andriy.shevchenko@intel.com>
CC: linux-gpio(a)vger.kernel.org
CC: linux-arm-msm(a)vger.kernel.org
CC: Shawn Guo <shawn.guo@linaro.org>

Hi Shawn,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pinctrl/devel]
[also build test WARNING on v5.12-rc2 next-20210310]
[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/pinctrl-qcom-sc8180x-add-ACPI-probe-support/20210311-104247
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
:::::: branch date: 68 minutes ago
:::::: commit date: 68 minutes ago
config: arm64-randconfig-m031-20210311 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/pinctrl/qcom/pinctrl-sc8180x.c:1664 sc8180x_pinctrl_add_tile_resources() error: potentially dereferencing uninitialized 'mres'.

vim +/mres +1664 drivers/pinctrl/qcom/pinctrl-sc8180x.c

76b21f18b22a6b Shawn Guo 2021-03-11  1623  
76b21f18b22a6b Shawn Guo 2021-03-11  1624  /*
76b21f18b22a6b Shawn Guo 2021-03-11  1625   * ACPI DSDT has one single memory resource for TLMM, which voilates the
76b21f18b22a6b Shawn Guo 2021-03-11  1626   * hardware layout of 3 sepearte tiles.  Let's split the memory resource into
76b21f18b22a6b Shawn Guo 2021-03-11  1627   * 3 named ones, so that msm_pinctrl_probe() can map memory for ACPI in the
76b21f18b22a6b Shawn Guo 2021-03-11  1628   * same way as for DT probe.
76b21f18b22a6b Shawn Guo 2021-03-11  1629   */
76b21f18b22a6b Shawn Guo 2021-03-11  1630  static int sc8180x_pinctrl_add_tile_resources(struct platform_device *pdev)
76b21f18b22a6b Shawn Guo 2021-03-11  1631  {
76b21f18b22a6b Shawn Guo 2021-03-11  1632  	int nres_num = pdev->num_resources + ARRAY_SIZE(sc8180x_tiles) - 1;
76b21f18b22a6b Shawn Guo 2021-03-11  1633  	struct resource *mres, *nres, *res;
76b21f18b22a6b Shawn Guo 2021-03-11  1634  	int i, ret;
76b21f18b22a6b Shawn Guo 2021-03-11  1635  
76b21f18b22a6b Shawn Guo 2021-03-11  1636  	/*
76b21f18b22a6b Shawn Guo 2021-03-11  1637  	 * DT already has tiles defined properly, so nothing needs to be done
76b21f18b22a6b Shawn Guo 2021-03-11  1638  	 * for DT probe.
76b21f18b22a6b Shawn Guo 2021-03-11  1639  	 */
76b21f18b22a6b Shawn Guo 2021-03-11  1640  	if (pdev->dev.of_node)
76b21f18b22a6b Shawn Guo 2021-03-11  1641  		return 0;
76b21f18b22a6b Shawn Guo 2021-03-11  1642  
76b21f18b22a6b Shawn Guo 2021-03-11  1643  	/* Allocate for new resources */
76b21f18b22a6b Shawn Guo 2021-03-11  1644  	nres = devm_kzalloc(&pdev->dev, sizeof(*nres) * nres_num, GFP_KERNEL);
76b21f18b22a6b Shawn Guo 2021-03-11  1645  	if (!nres)
76b21f18b22a6b Shawn Guo 2021-03-11  1646  		return -ENOMEM;
76b21f18b22a6b Shawn Guo 2021-03-11  1647  
76b21f18b22a6b Shawn Guo 2021-03-11  1648  	res = nres;
76b21f18b22a6b Shawn Guo 2021-03-11  1649  
76b21f18b22a6b Shawn Guo 2021-03-11  1650  	for (i = 0; i < pdev->num_resources; i++) {
76b21f18b22a6b Shawn Guo 2021-03-11  1651  		struct resource *r = &pdev->resource[i];
76b21f18b22a6b Shawn Guo 2021-03-11  1652  
76b21f18b22a6b Shawn Guo 2021-03-11  1653  		/* Save memory resource and copy others */
76b21f18b22a6b Shawn Guo 2021-03-11  1654  		if (resource_type(r) == IORESOURCE_MEM)
76b21f18b22a6b Shawn Guo 2021-03-11  1655  			mres = r;
76b21f18b22a6b Shawn Guo 2021-03-11  1656  		else
76b21f18b22a6b Shawn Guo 2021-03-11  1657  			*res++ = *r;
76b21f18b22a6b Shawn Guo 2021-03-11  1658  	}
76b21f18b22a6b Shawn Guo 2021-03-11  1659  
76b21f18b22a6b Shawn Guo 2021-03-11  1660  	/* Append tile memory resources */
76b21f18b22a6b Shawn Guo 2021-03-11  1661  	for (i = 0; i < ARRAY_SIZE(sc8180x_tiles); i++, res++) {
76b21f18b22a6b Shawn Guo 2021-03-11  1662  		const struct tile_info *info = &sc8180x_tile_info[i];
76b21f18b22a6b Shawn Guo 2021-03-11  1663  
76b21f18b22a6b Shawn Guo 2021-03-11 @1664  		res->start = mres->start + info->offset;
76b21f18b22a6b Shawn Guo 2021-03-11  1665  		res->end = mres->start + info->offset + info->size - 1;
76b21f18b22a6b Shawn Guo 2021-03-11  1666  		res->flags = mres->flags;
76b21f18b22a6b Shawn Guo 2021-03-11  1667  		res->name = sc8180x_tiles[i];
76b21f18b22a6b Shawn Guo 2021-03-11  1668  
76b21f18b22a6b Shawn Guo 2021-03-11  1669  		/* Add new MEM to resource tree */
76b21f18b22a6b Shawn Guo 2021-03-11  1670  		insert_resource(mres->parent, res);
76b21f18b22a6b Shawn Guo 2021-03-11  1671  	}
76b21f18b22a6b Shawn Guo 2021-03-11  1672  
76b21f18b22a6b Shawn Guo 2021-03-11  1673  	/* Remove old MEM from resource tree */
76b21f18b22a6b Shawn Guo 2021-03-11  1674  	remove_resource(mres);
76b21f18b22a6b Shawn Guo 2021-03-11  1675  
76b21f18b22a6b Shawn Guo 2021-03-11  1676  	/* Free old resources and install new ones */
76b21f18b22a6b Shawn Guo 2021-03-11  1677  	ret = platform_device_add_resources(pdev, nres, nres_num);
76b21f18b22a6b Shawn Guo 2021-03-11  1678  	if (ret) {
76b21f18b22a6b Shawn Guo 2021-03-11  1679  		dev_err(&pdev->dev, "failed to add new resources: %d\n", ret);
76b21f18b22a6b Shawn Guo 2021-03-11  1680  		return ret;
76b21f18b22a6b Shawn Guo 2021-03-11  1681  	}
76b21f18b22a6b Shawn Guo 2021-03-11  1682  
76b21f18b22a6b Shawn Guo 2021-03-11  1683  	return 0;
76b21f18b22a6b Shawn Guo 2021-03-11  1684  }
76b21f18b22a6b Shawn Guo 2021-03-11  1685  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29405 bytes --]

             reply	other threads:[~2021-03-11  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11  3:51 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-11  2:41 [PATCH v5] pinctrl: qcom: sc8180x: add ACPI probe support Shawn Guo
2021-03-11  4:06 ` Bjorn Andersson
2021-03-11 11:01 ` Andy Shevchenko
2021-03-15 16:32 ` Linus Walleij
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202103111141.dqlOhB77-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.