Re: [PATCH] drivers/pci/controller: fix warning PTR_ERR_OR_ZERO can be used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/05/2019 10:57, Hariprasad Kelam wrote:

> fix below warnings reported by coccichek
> 
> /drivers/pci/controller/pci-tegra.c:1132:1-3: WARNING: PTR_ERR_OR_ZERO
> can be used
> ./drivers/pci/controller/dwc/pcie-qcom.c:703:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/pci/controller/dwc/pci-meson.c:185:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./drivers/pci/controller/dwc/pci-meson.c:262:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> ./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
> ./drivers/pci/controller/dwc/pci-exynos.c:95:1-3: WARNING:
> PTR_ERR_OR_ZERO can be used
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@xxxxxxxxx>
> ---
>  drivers/pci/controller/dwc/pci-exynos.c | 4 +---
>  drivers/pci/controller/dwc/pci-meson.c  | 8 ++------
>  drivers/pci/controller/dwc/pcie-kirin.c | 8 ++------
>  drivers/pci/controller/dwc/pcie-qcom.c  | 4 +---
>  drivers/pci/controller/pci-tegra.c      | 4 +---
>  5 files changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 0ed235d..6c421e6 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -700,10 +700,8 @@ static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie)
>  		return PTR_ERR(res->ahb_reset);
>  
>  	res->phy_ahb_reset = devm_reset_control_get_exclusive(dev, "phy_ahb");
> -	if (IS_ERR(res->phy_ahb_reset))
> -		return PTR_ERR(res->phy_ahb_reset);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(res->phy_ahb_reset);
>  }
>  
>  static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie)

My opinion doesn't carry any weight, but IMO using PTR_ERR_OR_ZERO instead
of PTR_ERR breaks the symmetry of the previous operations.

It seems to give the last operation more importance than the previous ones,
which I don't find desirable.

Regards.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux