linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] PCI: dwc: artpec6: Fix return value check in artpec6_add_pcie_ep()
@ 2018-01-03  7:33 Wei Yongjun
  2018-01-03 11:43 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2018-01-03  7:33 UTC (permalink / raw)
  To: Niklas Cassel, Jesper Nilsson, Lorenzo Pieralisi, Bjorn Helgaas
  Cc: Wei Yongjun, linux-arm-kernel, linux-pci

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: b5074ef6fe7d ("PCI: dwc: artpec6: Add support for endpoint mode")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pci/dwc/pcie-artpec6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
index 312f21b..b1e9820 100644
--- a/drivers/pci/dwc/pcie-artpec6.c
+++ b/drivers/pci/dwc/pcie-artpec6.c
@@ -485,8 +485,8 @@ static int artpec6_add_pcie_ep(struct artpec6_pcie *artpec6_pcie,
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi2");
 	pci->dbi_base2 = devm_ioremap(dev, res->start, resource_size(res));
-	if (IS_ERR(pci->dbi_base2))
-		return PTR_ERR(pci->dbi_base2);
+	if (!pci->dbi_base2)
+		return -ENOMEM;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
 	if (!res)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] PCI: dwc: artpec6: Fix return value check in artpec6_add_pcie_ep()
  2018-01-03  7:33 [PATCH -next] PCI: dwc: artpec6: Fix return value check in artpec6_add_pcie_ep() Wei Yongjun
@ 2018-01-03 11:43 ` Lorenzo Pieralisi
  2018-01-09 15:21   ` Niklas Cassel
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Pieralisi @ 2018-01-03 11:43 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Niklas Cassel, Jesper Nilsson, Bjorn Helgaas, linux-arm-kernel,
	linux-pci

On Wed, Jan 03, 2018 at 07:33:35AM +0000, Wei Yongjun wrote:
> In case of error, the function devm_ioremap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
> 
> Fixes: b5074ef6fe7d ("PCI: dwc: artpec6: Add support for endpoint mode")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/pci/dwc/pcie-artpec6.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to pci/dwc for v4.16, thanks.

Lorenzo

> diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
> index 312f21b..b1e9820 100644
> --- a/drivers/pci/dwc/pcie-artpec6.c
> +++ b/drivers/pci/dwc/pcie-artpec6.c
> @@ -485,8 +485,8 @@ static int artpec6_add_pcie_ep(struct artpec6_pcie *artpec6_pcie,
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi2");
>  	pci->dbi_base2 = devm_ioremap(dev, res->start, resource_size(res));
> -	if (IS_ERR(pci->dbi_base2))
> -		return PTR_ERR(pci->dbi_base2);
> +	if (!pci->dbi_base2)
> +		return -ENOMEM;
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
>  	if (!res)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] PCI: dwc: artpec6: Fix return value check in artpec6_add_pcie_ep()
  2018-01-03 11:43 ` Lorenzo Pieralisi
@ 2018-01-09 15:21   ` Niklas Cassel
  0 siblings, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2018-01-09 15:21 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Wei Yongjun
  Cc: Jesper Nilsson, Bjorn Helgaas, linux-arm-kernel, linux-pci



On 03/01/18 12:43, Lorenzo Pieralisi wrote:
> On Wed, Jan 03, 2018 at 07:33:35AM +0000, Wei Yongjun wrote:
>> In case of error, the function devm_ioremap() returns NULL pointer
>> not ERR_PTR(). The IS_ERR() test in the return value check should be
>> replaced with NULL test.
>>
>> Fixes: b5074ef6fe7d ("PCI: dwc: artpec6: Add support for endpoint mode")
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>>  drivers/pci/dwc/pcie-artpec6.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Applied to pci/dwc for v4.16, thanks.
> 
> Lorenzo
> 

Argh.. I must have mixed up the return value from devm_ioremap()
with the return value from devm_ioremap_resource()
(which is used in other places in the driver).

However, dbi2 sets a bit to access the shadow registers,
so we have to use devm_ioremap() here, so it is correct
to fix the return handling.

Thanks for fixing this!

Acked-by: Niklas Cassel <niklas.cassel@axis.com>

>> diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
>> index 312f21b..b1e9820 100644
>> --- a/drivers/pci/dwc/pcie-artpec6.c
>> +++ b/drivers/pci/dwc/pcie-artpec6.c
>> @@ -485,8 +485,8 @@ static int artpec6_add_pcie_ep(struct artpec6_pcie *artpec6_pcie,
>>  
>>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi2");
>>  	pci->dbi_base2 = devm_ioremap(dev, res->start, resource_size(res));
>> -	if (IS_ERR(pci->dbi_base2))
>> -		return PTR_ERR(pci->dbi_base2);
>> +	if (!pci->dbi_base2)
>> +		return -ENOMEM;
>>  
>>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
>>  	if (!res)
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-09 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-03  7:33 [PATCH -next] PCI: dwc: artpec6: Fix return value check in artpec6_add_pcie_ep() Wei Yongjun
2018-01-03 11:43 ` Lorenzo Pieralisi
2018-01-09 15:21   ` Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).