PCI: kirin: Use PTR_ERR_OR_ZERO() to simplify code
diff mbox series

Message ID 1574076646-51621-1-git-send-email-zhengbin13@huawei.com
State Rejected
Delegated to: Lorenzo Pieralisi
Headers show
Series
  • PCI: kirin: Use PTR_ERR_OR_ZERO() to simplify code
Related show

Commit Message

Zheng Bin Nov. 18, 2019, 11:30 a.m. UTC
Fixes coccicheck warning:

drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used
drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 drivers/pci/controller/dwc/pcie-kirin.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--
2.7.4

Comments

Andrew Murray Nov. 18, 2019, 12:46 p.m. UTC | #1
On Mon, Nov 18, 2019 at 07:30:46PM +0800, zhengbin wrote:
> Fixes coccicheck warning:
> 
> drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  drivers/pci/controller/dwc/pcie-kirin.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> index c19617a..5b2131f 100644
> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
>  		return PTR_ERR(kirin_pcie->apb_sys_clk);
> 
>  	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
> -	if (IS_ERR(kirin_pcie->pcie_aclk))
> -		return PTR_ERR(kirin_pcie->pcie_aclk);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
>  }
> 
>  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,

Thanks for these patches. Though if you resend these next time you ought
to put them in a single patch series with a cover letter.

I'm not sure on the views of maintainers for other parts of the kernel
however for PCI this type of change has previously been rejected, see:

https://lkml.org/lkml/2019/5/31/535

I guess coccicheck isn't aware of this.

Thanks,

Andrew Murray

> --
> 2.7.4
>
Zheng Bin Nov. 18, 2019, 12:59 p.m. UTC | #2
On 2019/11/18 20:46, Andrew Murray wrote:
> On Mon, Nov 18, 2019 at 07:30:46PM +0800, zhengbin wrote:
>> Fixes coccicheck warning:
>>
>> drivers/pci/controller/dwc/pcie-kirin.c:141:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>> drivers/pci/controller/dwc/pcie-kirin.c:177:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: zhengbin <zhengbin13@huawei.com>
>> ---
>>  drivers/pci/controller/dwc/pcie-kirin.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
>> index c19617a..5b2131f 100644
>> --- a/drivers/pci/controller/dwc/pcie-kirin.c
>> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
>> @@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
>>  		return PTR_ERR(kirin_pcie->apb_sys_clk);
>>
>>  	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
>> -	if (IS_ERR(kirin_pcie->pcie_aclk))
>> -		return PTR_ERR(kirin_pcie->pcie_aclk);
>> -
>> -	return 0;
>> +	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
>>  }
>>
>>  static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
> Thanks for these patches. Though if you resend these next time you ought
> to put them in a single patch series with a cover letter.
>
> I'm not sure on the views of maintainers for other parts of the kernel
> however for PCI this type of change has previously been rejected, see:
>
> https://lkml.org/lkml/2019/5/31/535

got that, thanks. please ignore other pci patches.

>
> I guess coccicheck isn't aware of this.
>
> Thanks,
>
> Andrew Murray
>
>> --
>> 2.7.4
>>
> .
>

Patch
diff mbox series

diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index c19617a..5b2131f 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -138,10 +138,7 @@  static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
 		return PTR_ERR(kirin_pcie->apb_sys_clk);

 	kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
-	if (IS_ERR(kirin_pcie->pcie_aclk))
-		return PTR_ERR(kirin_pcie->pcie_aclk);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
 }

 static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,