linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging:pci-mt7621: Use PTR_ERR_OR_ZERO to replace the open code
@ 2018-08-13 10:54 zhong jiang
  2018-08-13 11:26 ` Sergio Paracuellos
  0 siblings, 1 reply; 3+ messages in thread
From: zhong jiang @ 2018-08-13 10:54 UTC (permalink / raw)
  To: gregkh
  Cc: sergio.paracuellos, neil, peter.vernia, oliver.huebers, linux-kernel

PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So
just replace them rather than duplicating its implement.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index a49e279..9a8ff1d 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -403,10 +403,8 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie)
 	}
 
 	pcie->base = devm_ioremap_resource(dev, &regs);
-	if (IS_ERR(pcie->base))
-		return PTR_ERR(pcie->base);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pcie->base);
 }
 
 static int mt7621_pcie_request_resources(struct mt7621_pcie *pcie,
-- 
1.7.12.4


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

* Re: [PATCH] staging:pci-mt7621: Use PTR_ERR_OR_ZERO to replace the open code
  2018-08-13 10:54 [PATCH] staging:pci-mt7621: Use PTR_ERR_OR_ZERO to replace the open code zhong jiang
@ 2018-08-13 11:26 ` Sergio Paracuellos
  2018-08-13 11:33   ` zhong jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Sergio Paracuellos @ 2018-08-13 11:26 UTC (permalink / raw)
  To: zhong jiang
  Cc: Greg KH, NeilBrown, peter.vernia, oliver.huebers, linux-kernel

On Mon, Aug 13, 2018 at 12:54 PM, zhong jiang <zhongjiang@huawei.com> wrote:
> PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So
> just replace them rather than duplicating its implement.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/staging/mt7621-pci/pci-mt7621.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
> index a49e279..9a8ff1d 100644
> --- a/drivers/staging/mt7621-pci/pci-mt7621.c
> +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
> @@ -403,10 +403,8 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie)
>         }
>
>         pcie->base = devm_ioremap_resource(dev, &regs);
> -       if (IS_ERR(pcie->base))
> -               return PTR_ERR(pcie->base);
>
> -       return 0;
> +       return PTR_ERR_OR_ZERO(pcie->base);
>  }

Hi Zhong,

Thanks for this. This driver is in the middle of cleanup and this
function is not doing all the DT parse
yet, so this patch looks good but after applying this series (if they
work and are good enough to be applied)
has no sense.

See: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-August/124890.html

Best regards,
    Sergio Paracuellos

>
>  static int mt7621_pcie_request_resources(struct mt7621_pcie *pcie,
> --
> 1.7.12.4
>

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

* Re: [PATCH] staging:pci-mt7621: Use PTR_ERR_OR_ZERO to replace the open code
  2018-08-13 11:26 ` Sergio Paracuellos
@ 2018-08-13 11:33   ` zhong jiang
  0 siblings, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-08-13 11:33 UTC (permalink / raw)
  To: Sergio Paracuellos
  Cc: Greg KH, NeilBrown, peter.vernia, oliver.huebers, linux-kernel

On 2018/8/13 19:26, Sergio Paracuellos wrote:
> On Mon, Aug 13, 2018 at 12:54 PM, zhong jiang <zhongjiang@huawei.com> wrote:
>> PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So
>> just replace them rather than duplicating its implement.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  drivers/staging/mt7621-pci/pci-mt7621.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
>> index a49e279..9a8ff1d 100644
>> --- a/drivers/staging/mt7621-pci/pci-mt7621.c
>> +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
>> @@ -403,10 +403,8 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie)
>>         }
>>
>>         pcie->base = devm_ioremap_resource(dev, &regs);
>> -       if (IS_ERR(pcie->base))
>> -               return PTR_ERR(pcie->base);
>>
>> -       return 0;
>> +       return PTR_ERR_OR_ZERO(pcie->base);
>>  }
> Hi Zhong,
>
> Thanks for this. This driver is in the middle of cleanup and this
> function is not doing all the DT parse
> yet, so this patch looks good but after applying this series (if they
> work and are good enough to be applied)
> has no sense.
>
> See: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-August/124890.html
>
> Best regards,
>     Sergio Paracuellos
Thank you for let me know that.

Sincerely,
zhong jiang
>>  static int mt7621_pcie_request_resources(struct mt7621_pcie *pcie,
>> --
>> 1.7.12.4
>>
> .
>



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

end of thread, other threads:[~2018-08-13 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 10:54 [PATCH] staging:pci-mt7621: Use PTR_ERR_OR_ZERO to replace the open code zhong jiang
2018-08-13 11:26 ` Sergio Paracuellos
2018-08-13 11:33   ` zhong jiang

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).