All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	bcm-kernel-feedback-list@broadcom.com
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rich Felker <dalias@libc.org>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	David Airlie <airlied@linux.ie>,
	Hanjun Guo <guohanjun@huawei.com>,
	"open list:REMOTE PROCESSOR REMOTEPROC SUBSYSTEM"
	<linux-remoteproc@vger.kernel.org>
Subject: Re: [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset
Date: Tue, 07 Jul 2020 13:27:24 +0000	[thread overview]
Message-ID: <20200707132724.GT2549@kadam> (raw)
In-Reply-To: <20200701212155.37830-9-james.quinlan@broadcom.com>

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

Hi Jim,

url:    https://github.com/0day-ci/linux/commits/Jim-Quinlan/PCI-brcmstb-enable-PCIe-for-STB-chips/20200702-053156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-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/of/address.c:1012 of_dma_get_range() warn: passing zero to 'ERR_PTR'

# https://github.com/0day-ci/linux/commit/0c50b6db383883854419f10df0d79b663433f121
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 0c50b6db383883854419f10df0d79b663433f121
vim +/ERR_PTR +1012 drivers/of/address.c

18308c94723e16 Grygorii Strashko 2014-04-24   955  /**
0c50b6db383883 Jim Quinlan       2020-07-01   956   * of_dma_get_range - Get DMA range info and put it into a map array
18308c94723e16 Grygorii Strashko 2014-04-24   957   * @np:		device node to get DMA range info
18308c94723e16 Grygorii Strashko 2014-04-24   958   *
18308c94723e16 Grygorii Strashko 2014-04-24   959   * Look in bottom up direction for the first "dma-ranges" property
0c50b6db383883 Jim Quinlan       2020-07-01   960   * and parse it.  Put the information into a DMA offset map array.
0c50b6db383883 Jim Quinlan       2020-07-01   961   *
18308c94723e16 Grygorii Strashko 2014-04-24   962   * dma-ranges format:
18308c94723e16 Grygorii Strashko 2014-04-24   963   *	DMA addr (dma_addr)	: naddr cells
18308c94723e16 Grygorii Strashko 2014-04-24   964   *	CPU addr (phys_addr_t)	: pna cells
18308c94723e16 Grygorii Strashko 2014-04-24   965   *	size			: nsize cells
18308c94723e16 Grygorii Strashko 2014-04-24   966   *
0c50b6db383883 Jim Quinlan       2020-07-01   967   * It returns -ENODEV if "dma-ranges" property was not found for this
0c50b6db383883 Jim Quinlan       2020-07-01   968   * device in the DT.
18308c94723e16 Grygorii Strashko 2014-04-24   969   */
0c50b6db383883 Jim Quinlan       2020-07-01   970  const struct bus_dma_region *of_dma_get_range(struct device_node *np)
18308c94723e16 Grygorii Strashko 2014-04-24   971  {
0c50b6db383883 Jim Quinlan       2020-07-01   972  	const struct bus_dma_region *map = NULL;
18308c94723e16 Grygorii Strashko 2014-04-24   973  	struct device_node *node = of_node_get(np);
0c50b6db383883 Jim Quinlan       2020-07-01   974  	struct of_range_parser parser;
18308c94723e16 Grygorii Strashko 2014-04-24   975  	const __be32 *ranges = NULL;
951d48855d86e7 Robin Murphy      2019-07-03   976  	bool found_dma_ranges = false;
7a8b64d17e3581 Rob Herring       2020-02-06   977  	struct of_range range;
0c50b6db383883 Jim Quinlan       2020-07-01   978  	int len, num_ranges = 0;
0c50b6db383883 Jim Quinlan       2020-07-01   979  	int ret = 0;
18308c94723e16 Grygorii Strashko 2014-04-24   980  
951d48855d86e7 Robin Murphy      2019-07-03   981  	while (node) {
18308c94723e16 Grygorii Strashko 2014-04-24   982  		ranges = of_get_property(node, "dma-ranges", &len);
18308c94723e16 Grygorii Strashko 2014-04-24   983  
18308c94723e16 Grygorii Strashko 2014-04-24   984  		/* Ignore empty ranges, they imply no translation required */
18308c94723e16 Grygorii Strashko 2014-04-24   985  		if (ranges && len > 0)
18308c94723e16 Grygorii Strashko 2014-04-24   986  			break;
18308c94723e16 Grygorii Strashko 2014-04-24   987  
951d48855d86e7 Robin Murphy      2019-07-03   988  		/* Once we find 'dma-ranges', then a missing one is an error */
951d48855d86e7 Robin Murphy      2019-07-03   989  		if (found_dma_ranges && !ranges) {
951d48855d86e7 Robin Murphy      2019-07-03   990  			ret = -ENODEV;
951d48855d86e7 Robin Murphy      2019-07-03   991  			goto out;
18308c94723e16 Grygorii Strashko 2014-04-24   992  		}
951d48855d86e7 Robin Murphy      2019-07-03   993  		found_dma_ranges = true;
18308c94723e16 Grygorii Strashko 2014-04-24   994  
951d48855d86e7 Robin Murphy      2019-07-03   995  		node = of_get_next_dma_parent(node);
951d48855d86e7 Robin Murphy      2019-07-03   996  	}
951d48855d86e7 Robin Murphy      2019-07-03   997  
951d48855d86e7 Robin Murphy      2019-07-03   998  	if (!node || !ranges) {
0d638a07d3a1e9 Rob Herring       2017-06-01   999  		pr_debug("no dma-ranges found for node(%pOF)\n", np);
18308c94723e16 Grygorii Strashko 2014-04-24  1000  		ret = -ENODEV;
18308c94723e16 Grygorii Strashko 2014-04-24  1001  		goto out;
18308c94723e16 Grygorii Strashko 2014-04-24  1002  	}
18308c94723e16 Grygorii Strashko 2014-04-24  1003  
7a8b64d17e3581 Rob Herring       2020-02-06  1004  	of_dma_range_parser_init(&parser, node);
7a8b64d17e3581 Rob Herring       2020-02-06  1005  
0c50b6db383883 Jim Quinlan       2020-07-01  1006  	for_each_of_range(&parser, &range)
0c50b6db383883 Jim Quinlan       2020-07-01  1007  		num_ranges++;
18308c94723e16 Grygorii Strashko 2014-04-24  1008  
0c50b6db383883 Jim Quinlan       2020-07-01  1009  	map = dma_create_offset_map(node, num_ranges);
                                                        ^^^
If this fails then "ret" is zero so the function returns NULL instead of
an error pointer.

18308c94723e16 Grygorii Strashko 2014-04-24  1010  out:
18308c94723e16 Grygorii Strashko 2014-04-24  1011  	of_node_put(node);
0c50b6db383883 Jim Quinlan       2020-07-01 @1012  	return map ? map : ERR_PTR(ret);
92ea637edea36e Santosh Shilimkar 2014-04-24  1014  

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

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Jim Quinlan <james.quinlan@broadcom.com>,
	linux-pci@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	bcm-kernel-feedback-list@broadcom.com
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rich Felker <dalias@libc.org>,
	"open list:SUPERH" <linux-sh@vger.kernel.org>,
	David Airlie <airlied@linux.ie>,
	Hanjun Guo <guohanjun@huawei.com>,
	"open list:REMOTE PROCESSOR REMOTEPROC SUBSYSTEM" 
	<linux-remoteproc@vger.kernel.org>
Subject: Re: [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset
Date: Tue, 7 Jul 2020 16:27:24 +0300	[thread overview]
Message-ID: <20200707132724.GT2549@kadam> (raw)
In-Reply-To: <20200701212155.37830-9-james.quinlan@broadcom.com>

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

Hi Jim,

url:    https://github.com/0day-ci/linux/commits/Jim-Quinlan/PCI-brcmstb-enable-PCIe-for-STB-chips/20200702-053156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-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/of/address.c:1012 of_dma_get_range() warn: passing zero to 'ERR_PTR'

# https://github.com/0day-ci/linux/commit/0c50b6db383883854419f10df0d79b663433f121
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 0c50b6db383883854419f10df0d79b663433f121
vim +/ERR_PTR +1012 drivers/of/address.c

18308c94723e16 Grygorii Strashko 2014-04-24   955  /**
0c50b6db383883 Jim Quinlan       2020-07-01   956   * of_dma_get_range - Get DMA range info and put it into a map array
18308c94723e16 Grygorii Strashko 2014-04-24   957   * @np:		device node to get DMA range info
18308c94723e16 Grygorii Strashko 2014-04-24   958   *
18308c94723e16 Grygorii Strashko 2014-04-24   959   * Look in bottom up direction for the first "dma-ranges" property
0c50b6db383883 Jim Quinlan       2020-07-01   960   * and parse it.  Put the information into a DMA offset map array.
0c50b6db383883 Jim Quinlan       2020-07-01   961   *
18308c94723e16 Grygorii Strashko 2014-04-24   962   * dma-ranges format:
18308c94723e16 Grygorii Strashko 2014-04-24   963   *	DMA addr (dma_addr)	: naddr cells
18308c94723e16 Grygorii Strashko 2014-04-24   964   *	CPU addr (phys_addr_t)	: pna cells
18308c94723e16 Grygorii Strashko 2014-04-24   965   *	size			: nsize cells
18308c94723e16 Grygorii Strashko 2014-04-24   966   *
0c50b6db383883 Jim Quinlan       2020-07-01   967   * It returns -ENODEV if "dma-ranges" property was not found for this
0c50b6db383883 Jim Quinlan       2020-07-01   968   * device in the DT.
18308c94723e16 Grygorii Strashko 2014-04-24   969   */
0c50b6db383883 Jim Quinlan       2020-07-01   970  const struct bus_dma_region *of_dma_get_range(struct device_node *np)
18308c94723e16 Grygorii Strashko 2014-04-24   971  {
0c50b6db383883 Jim Quinlan       2020-07-01   972  	const struct bus_dma_region *map = NULL;
18308c94723e16 Grygorii Strashko 2014-04-24   973  	struct device_node *node = of_node_get(np);
0c50b6db383883 Jim Quinlan       2020-07-01   974  	struct of_range_parser parser;
18308c94723e16 Grygorii Strashko 2014-04-24   975  	const __be32 *ranges = NULL;
951d48855d86e7 Robin Murphy      2019-07-03   976  	bool found_dma_ranges = false;
7a8b64d17e3581 Rob Herring       2020-02-06   977  	struct of_range range;
0c50b6db383883 Jim Quinlan       2020-07-01   978  	int len, num_ranges = 0;
0c50b6db383883 Jim Quinlan       2020-07-01   979  	int ret = 0;
18308c94723e16 Grygorii Strashko 2014-04-24   980  
951d48855d86e7 Robin Murphy      2019-07-03   981  	while (node) {
18308c94723e16 Grygorii Strashko 2014-04-24   982  		ranges = of_get_property(node, "dma-ranges", &len);
18308c94723e16 Grygorii Strashko 2014-04-24   983  
18308c94723e16 Grygorii Strashko 2014-04-24   984  		/* Ignore empty ranges, they imply no translation required */
18308c94723e16 Grygorii Strashko 2014-04-24   985  		if (ranges && len > 0)
18308c94723e16 Grygorii Strashko 2014-04-24   986  			break;
18308c94723e16 Grygorii Strashko 2014-04-24   987  
951d48855d86e7 Robin Murphy      2019-07-03   988  		/* Once we find 'dma-ranges', then a missing one is an error */
951d48855d86e7 Robin Murphy      2019-07-03   989  		if (found_dma_ranges && !ranges) {
951d48855d86e7 Robin Murphy      2019-07-03   990  			ret = -ENODEV;
951d48855d86e7 Robin Murphy      2019-07-03   991  			goto out;
18308c94723e16 Grygorii Strashko 2014-04-24   992  		}
951d48855d86e7 Robin Murphy      2019-07-03   993  		found_dma_ranges = true;
18308c94723e16 Grygorii Strashko 2014-04-24   994  
951d48855d86e7 Robin Murphy      2019-07-03   995  		node = of_get_next_dma_parent(node);
951d48855d86e7 Robin Murphy      2019-07-03   996  	}
951d48855d86e7 Robin Murphy      2019-07-03   997  
951d48855d86e7 Robin Murphy      2019-07-03   998  	if (!node || !ranges) {
0d638a07d3a1e9 Rob Herring       2017-06-01   999  		pr_debug("no dma-ranges found for node(%pOF)\n", np);
18308c94723e16 Grygorii Strashko 2014-04-24  1000  		ret = -ENODEV;
18308c94723e16 Grygorii Strashko 2014-04-24  1001  		goto out;
18308c94723e16 Grygorii Strashko 2014-04-24  1002  	}
18308c94723e16 Grygorii Strashko 2014-04-24  1003  
7a8b64d17e3581 Rob Herring       2020-02-06  1004  	of_dma_range_parser_init(&parser, node);
7a8b64d17e3581 Rob Herring       2020-02-06  1005  
0c50b6db383883 Jim Quinlan       2020-07-01  1006  	for_each_of_range(&parser, &range)
0c50b6db383883 Jim Quinlan       2020-07-01  1007  		num_ranges++;
18308c94723e16 Grygorii Strashko 2014-04-24  1008  
0c50b6db383883 Jim Quinlan       2020-07-01  1009  	map = dma_create_offset_map(node, num_ranges);
                                                        ^^^
If this fails then "ret" is zero so the function returns NULL instead of
an error pointer.

18308c94723e16 Grygorii Strashko 2014-04-24  1010  out:
18308c94723e16 Grygorii Strashko 2014-04-24  1011  	of_node_put(node);
0c50b6db383883 Jim Quinlan       2020-07-01 @1012  	return map ? map : ERR_PTR(ret);
92ea637edea36e Santosh Shilimkar 2014-04-24  1014  

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

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset
Date: Tue, 07 Jul 2020 16:27:24 +0300	[thread overview]
Message-ID: <20200707132724.GT2549@kadam> (raw)
In-Reply-To: <20200701212155.37830-9-james.quinlan@broadcom.com>

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

Hi Jim,

url:    https://github.com/0day-ci/linux/commits/Jim-Quinlan/PCI-brcmstb-enable-PCIe-for-STB-chips/20200702-053156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-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/of/address.c:1012 of_dma_get_range() warn: passing zero to 'ERR_PTR'

# https://github.com/0day-ci/linux/commit/0c50b6db383883854419f10df0d79b663433f121
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 0c50b6db383883854419f10df0d79b663433f121
vim +/ERR_PTR +1012 drivers/of/address.c

18308c94723e16 Grygorii Strashko 2014-04-24   955  /**
0c50b6db383883 Jim Quinlan       2020-07-01   956   * of_dma_get_range - Get DMA range info and put it into a map array
18308c94723e16 Grygorii Strashko 2014-04-24   957   * @np:		device node to get DMA range info
18308c94723e16 Grygorii Strashko 2014-04-24   958   *
18308c94723e16 Grygorii Strashko 2014-04-24   959   * Look in bottom up direction for the first "dma-ranges" property
0c50b6db383883 Jim Quinlan       2020-07-01   960   * and parse it.  Put the information into a DMA offset map array.
0c50b6db383883 Jim Quinlan       2020-07-01   961   *
18308c94723e16 Grygorii Strashko 2014-04-24   962   * dma-ranges format:
18308c94723e16 Grygorii Strashko 2014-04-24   963   *	DMA addr (dma_addr)	: naddr cells
18308c94723e16 Grygorii Strashko 2014-04-24   964   *	CPU addr (phys_addr_t)	: pna cells
18308c94723e16 Grygorii Strashko 2014-04-24   965   *	size			: nsize cells
18308c94723e16 Grygorii Strashko 2014-04-24   966   *
0c50b6db383883 Jim Quinlan       2020-07-01   967   * It returns -ENODEV if "dma-ranges" property was not found for this
0c50b6db383883 Jim Quinlan       2020-07-01   968   * device in the DT.
18308c94723e16 Grygorii Strashko 2014-04-24   969   */
0c50b6db383883 Jim Quinlan       2020-07-01   970  const struct bus_dma_region *of_dma_get_range(struct device_node *np)
18308c94723e16 Grygorii Strashko 2014-04-24   971  {
0c50b6db383883 Jim Quinlan       2020-07-01   972  	const struct bus_dma_region *map = NULL;
18308c94723e16 Grygorii Strashko 2014-04-24   973  	struct device_node *node = of_node_get(np);
0c50b6db383883 Jim Quinlan       2020-07-01   974  	struct of_range_parser parser;
18308c94723e16 Grygorii Strashko 2014-04-24   975  	const __be32 *ranges = NULL;
951d48855d86e7 Robin Murphy      2019-07-03   976  	bool found_dma_ranges = false;
7a8b64d17e3581 Rob Herring       2020-02-06   977  	struct of_range range;
0c50b6db383883 Jim Quinlan       2020-07-01   978  	int len, num_ranges = 0;
0c50b6db383883 Jim Quinlan       2020-07-01   979  	int ret = 0;
18308c94723e16 Grygorii Strashko 2014-04-24   980  
951d48855d86e7 Robin Murphy      2019-07-03   981  	while (node) {
18308c94723e16 Grygorii Strashko 2014-04-24   982  		ranges = of_get_property(node, "dma-ranges", &len);
18308c94723e16 Grygorii Strashko 2014-04-24   983  
18308c94723e16 Grygorii Strashko 2014-04-24   984  		/* Ignore empty ranges, they imply no translation required */
18308c94723e16 Grygorii Strashko 2014-04-24   985  		if (ranges && len > 0)
18308c94723e16 Grygorii Strashko 2014-04-24   986  			break;
18308c94723e16 Grygorii Strashko 2014-04-24   987  
951d48855d86e7 Robin Murphy      2019-07-03   988  		/* Once we find 'dma-ranges', then a missing one is an error */
951d48855d86e7 Robin Murphy      2019-07-03   989  		if (found_dma_ranges && !ranges) {
951d48855d86e7 Robin Murphy      2019-07-03   990  			ret = -ENODEV;
951d48855d86e7 Robin Murphy      2019-07-03   991  			goto out;
18308c94723e16 Grygorii Strashko 2014-04-24   992  		}
951d48855d86e7 Robin Murphy      2019-07-03   993  		found_dma_ranges = true;
18308c94723e16 Grygorii Strashko 2014-04-24   994  
951d48855d86e7 Robin Murphy      2019-07-03   995  		node = of_get_next_dma_parent(node);
951d48855d86e7 Robin Murphy      2019-07-03   996  	}
951d48855d86e7 Robin Murphy      2019-07-03   997  
951d48855d86e7 Robin Murphy      2019-07-03   998  	if (!node || !ranges) {
0d638a07d3a1e9 Rob Herring       2017-06-01   999  		pr_debug("no dma-ranges found for node(%pOF)\n", np);
18308c94723e16 Grygorii Strashko 2014-04-24  1000  		ret = -ENODEV;
18308c94723e16 Grygorii Strashko 2014-04-24  1001  		goto out;
18308c94723e16 Grygorii Strashko 2014-04-24  1002  	}
18308c94723e16 Grygorii Strashko 2014-04-24  1003  
7a8b64d17e3581 Rob Herring       2020-02-06  1004  	of_dma_range_parser_init(&parser, node);
7a8b64d17e3581 Rob Herring       2020-02-06  1005  
0c50b6db383883 Jim Quinlan       2020-07-01  1006  	for_each_of_range(&parser, &range)
0c50b6db383883 Jim Quinlan       2020-07-01  1007  		num_ranges++;
18308c94723e16 Grygorii Strashko 2014-04-24  1008  
0c50b6db383883 Jim Quinlan       2020-07-01  1009  	map = dma_create_offset_map(node, num_ranges);
                                                        ^^^
If this fails then "ret" is zero so the function returns NULL instead of
an error pointer.

18308c94723e16 Grygorii Strashko 2014-04-24  1010  out:
18308c94723e16 Grygorii Strashko 2014-04-24  1011  	of_node_put(node);
0c50b6db383883 Jim Quinlan       2020-07-01 @1012  	return map ? map : ERR_PTR(ret);
92ea637edea36e Santosh Shilimkar 2014-04-24  1014  

---
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: 27423 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset
Date: Tue, 07 Jul 2020 16:27:24 +0300	[thread overview]
Message-ID: <20200707132724.GT2549@kadam> (raw)
In-Reply-To: <20200701212155.37830-9-james.quinlan@broadcom.com>

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

Hi Jim,

url:    https://github.com/0day-ci/linux/commits/Jim-Quinlan/PCI-brcmstb-enable-PCIe-for-STB-chips/20200702-053156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-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/of/address.c:1012 of_dma_get_range() warn: passing zero to 'ERR_PTR'

# https://github.com/0day-ci/linux/commit/0c50b6db383883854419f10df0d79b663433f121
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 0c50b6db383883854419f10df0d79b663433f121
vim +/ERR_PTR +1012 drivers/of/address.c

18308c94723e16 Grygorii Strashko 2014-04-24   955  /**
0c50b6db383883 Jim Quinlan       2020-07-01   956   * of_dma_get_range - Get DMA range info and put it into a map array
18308c94723e16 Grygorii Strashko 2014-04-24   957   * @np:		device node to get DMA range info
18308c94723e16 Grygorii Strashko 2014-04-24   958   *
18308c94723e16 Grygorii Strashko 2014-04-24   959   * Look in bottom up direction for the first "dma-ranges" property
0c50b6db383883 Jim Quinlan       2020-07-01   960   * and parse it.  Put the information into a DMA offset map array.
0c50b6db383883 Jim Quinlan       2020-07-01   961   *
18308c94723e16 Grygorii Strashko 2014-04-24   962   * dma-ranges format:
18308c94723e16 Grygorii Strashko 2014-04-24   963   *	DMA addr (dma_addr)	: naddr cells
18308c94723e16 Grygorii Strashko 2014-04-24   964   *	CPU addr (phys_addr_t)	: pna cells
18308c94723e16 Grygorii Strashko 2014-04-24   965   *	size			: nsize cells
18308c94723e16 Grygorii Strashko 2014-04-24   966   *
0c50b6db383883 Jim Quinlan       2020-07-01   967   * It returns -ENODEV if "dma-ranges" property was not found for this
0c50b6db383883 Jim Quinlan       2020-07-01   968   * device in the DT.
18308c94723e16 Grygorii Strashko 2014-04-24   969   */
0c50b6db383883 Jim Quinlan       2020-07-01   970  const struct bus_dma_region *of_dma_get_range(struct device_node *np)
18308c94723e16 Grygorii Strashko 2014-04-24   971  {
0c50b6db383883 Jim Quinlan       2020-07-01   972  	const struct bus_dma_region *map = NULL;
18308c94723e16 Grygorii Strashko 2014-04-24   973  	struct device_node *node = of_node_get(np);
0c50b6db383883 Jim Quinlan       2020-07-01   974  	struct of_range_parser parser;
18308c94723e16 Grygorii Strashko 2014-04-24   975  	const __be32 *ranges = NULL;
951d48855d86e7 Robin Murphy      2019-07-03   976  	bool found_dma_ranges = false;
7a8b64d17e3581 Rob Herring       2020-02-06   977  	struct of_range range;
0c50b6db383883 Jim Quinlan       2020-07-01   978  	int len, num_ranges = 0;
0c50b6db383883 Jim Quinlan       2020-07-01   979  	int ret = 0;
18308c94723e16 Grygorii Strashko 2014-04-24   980  
951d48855d86e7 Robin Murphy      2019-07-03   981  	while (node) {
18308c94723e16 Grygorii Strashko 2014-04-24   982  		ranges = of_get_property(node, "dma-ranges", &len);
18308c94723e16 Grygorii Strashko 2014-04-24   983  
18308c94723e16 Grygorii Strashko 2014-04-24   984  		/* Ignore empty ranges, they imply no translation required */
18308c94723e16 Grygorii Strashko 2014-04-24   985  		if (ranges && len > 0)
18308c94723e16 Grygorii Strashko 2014-04-24   986  			break;
18308c94723e16 Grygorii Strashko 2014-04-24   987  
951d48855d86e7 Robin Murphy      2019-07-03   988  		/* Once we find 'dma-ranges', then a missing one is an error */
951d48855d86e7 Robin Murphy      2019-07-03   989  		if (found_dma_ranges && !ranges) {
951d48855d86e7 Robin Murphy      2019-07-03   990  			ret = -ENODEV;
951d48855d86e7 Robin Murphy      2019-07-03   991  			goto out;
18308c94723e16 Grygorii Strashko 2014-04-24   992  		}
951d48855d86e7 Robin Murphy      2019-07-03   993  		found_dma_ranges = true;
18308c94723e16 Grygorii Strashko 2014-04-24   994  
951d48855d86e7 Robin Murphy      2019-07-03   995  		node = of_get_next_dma_parent(node);
951d48855d86e7 Robin Murphy      2019-07-03   996  	}
951d48855d86e7 Robin Murphy      2019-07-03   997  
951d48855d86e7 Robin Murphy      2019-07-03   998  	if (!node || !ranges) {
0d638a07d3a1e9 Rob Herring       2017-06-01   999  		pr_debug("no dma-ranges found for node(%pOF)\n", np);
18308c94723e16 Grygorii Strashko 2014-04-24  1000  		ret = -ENODEV;
18308c94723e16 Grygorii Strashko 2014-04-24  1001  		goto out;
18308c94723e16 Grygorii Strashko 2014-04-24  1002  	}
18308c94723e16 Grygorii Strashko 2014-04-24  1003  
7a8b64d17e3581 Rob Herring       2020-02-06  1004  	of_dma_range_parser_init(&parser, node);
7a8b64d17e3581 Rob Herring       2020-02-06  1005  
0c50b6db383883 Jim Quinlan       2020-07-01  1006  	for_each_of_range(&parser, &range)
0c50b6db383883 Jim Quinlan       2020-07-01  1007  		num_ranges++;
18308c94723e16 Grygorii Strashko 2014-04-24  1008  
0c50b6db383883 Jim Quinlan       2020-07-01  1009  	map = dma_create_offset_map(node, num_ranges);
                                                        ^^^
If this fails then "ret" is zero so the function returns NULL instead of
an error pointer.

18308c94723e16 Grygorii Strashko 2014-04-24  1010  out:
18308c94723e16 Grygorii Strashko 2014-04-24  1011  	of_node_put(node);
0c50b6db383883 Jim Quinlan       2020-07-01 @1012  	return map ? map : ERR_PTR(ret);
92ea637edea36e Santosh Shilimkar 2014-04-24  1014  

---
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: 27423 bytes --]

  parent reply	other threads:[~2020-07-07 13:27 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 21:21 [PATCH v6 00/12] PCI: brcmstb: enable PCIe for STB chips Jim Quinlan
2020-07-01 21:21 ` Jim Quinlan
2020-07-01 21:21 ` Jim Quinlan
2020-07-01 21:21 ` Jim Quinlan via iommu
2020-07-01 21:21 ` Jim Quinlan
2020-07-01 21:21 ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 01/12] PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 02/12] ata: ahci_brcm: Fix use of BCM7216 reset controller Jim Quinlan
2020-07-02  9:32   ` Sergei Shtylyov
2020-07-06 14:31     ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 03/12] dt-bindings: PCI: Add bindings for more Brcmstb chips Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 04/12] PCI: brcmstb: Add bcm7278 register info Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 05/12] PCI: brcmstb: Add suspend and resume pm_ops Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 06/12] PCI: brcmstb: Add bcm7278 PERST# support Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 07/12] PCI: brcmstb: Add control of rescal reset Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan via iommu
2020-07-02  5:21   ` kernel test robot
2020-07-02  8:42   ` Andy Shevchenko
2020-07-02  8:42     ` Andy Shevchenko
2020-07-02  8:42     ` Andy Shevchenko
2020-07-06 13:40     ` Jim Quinlan
2020-07-06 13:40       ` Jim Quinlan
2020-07-06 13:40       ` Jim Quinlan via iommu
2020-07-07 13:27   ` Dan Carpenter [this message]
2020-07-07 13:27     ` Dan Carpenter
2020-07-07 13:27     ` Dan Carpenter
2020-07-07 13:27     ` Dan Carpenter
2020-07-07 14:44     ` Jim Quinlan
2020-07-07 14:44       ` Jim Quinlan
2020-07-07 14:44       ` Jim Quinlan
2020-07-07 15:11       ` Dan Carpenter
2020-07-07 15:11         ` Dan Carpenter
2020-07-07 15:11         ` Dan Carpenter
2020-07-07 15:11         ` Dan Carpenter
2020-07-01 21:21 ` [PATCH v6 09/12] PCI: brcmstb: Set additional internal memory DMA viewport sizes Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 10/12] PCI: brcmstb: Accommodate MSI for older chips Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 11/12] PCI: brcmstb: Set bus max burst size by chip type Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-01 21:21 ` [PATCH v6 12/12] PCI: brcmstb: Add bcm7211, bcm7216, bcm7445, bcm7278 to match list Jim Quinlan
2020-07-01 21:21   ` Jim Quinlan
2020-07-02  8:57 [PATCH v6 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset kernel test robot

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=20200707132724.GT2549@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dalias@libc.org \
    --cc=guohanjun@huawei.com \
    --cc=james.quinlan@broadcom.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=ulf.hansson@linaro.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.