linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] phy: tegra: Use PTR_ERR_OR_ZERO in tegra_p2u_probe()
@ 2019-08-22  6:34 YueHaibing
  2019-08-23  7:04 ` Vidya Sagar
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-08-22  6:34 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Thierry Reding, Jonathan Hunter,
	Lorenzo Pieralisi, Vidya Sagar
  Cc: YueHaibing, linux-kernel, linux-tegra, kernel-janitors

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/phy/tegra/phy-tegra194-p2u.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/phy/tegra/phy-tegra194-p2u.c b/drivers/phy/tegra/phy-tegra194-p2u.c
index 7042bed9feaa..42394d27f4cb 100644
--- a/drivers/phy/tegra/phy-tegra194-p2u.c
+++ b/drivers/phy/tegra/phy-tegra194-p2u.c
@@ -92,10 +92,7 @@ static int tegra_p2u_probe(struct platform_device *pdev)
 	phy_set_drvdata(generic_phy, phy);
 
 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-	if (IS_ERR(phy_provider))
-		return PTR_ERR(phy_provider);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(phy_provider);
 }
 
 static const struct of_device_id tegra_p2u_id_table[] = {






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

* Re: [PATCH -next] phy: tegra: Use PTR_ERR_OR_ZERO in tegra_p2u_probe()
  2019-08-22  6:34 [PATCH -next] phy: tegra: Use PTR_ERR_OR_ZERO in tegra_p2u_probe() YueHaibing
@ 2019-08-23  7:04 ` Vidya Sagar
  0 siblings, 0 replies; 2+ messages in thread
From: Vidya Sagar @ 2019-08-23  7:04 UTC (permalink / raw)
  To: YueHaibing, Kishon Vijay Abraham I, Thierry Reding,
	Jonathan Hunter, Lorenzo Pieralisi
  Cc: linux-kernel, linux-tegra, kernel-janitors

On 8/22/2019 12:04 PM, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/phy/tegra/phy-tegra194-p2u.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/phy/tegra/phy-tegra194-p2u.c b/drivers/phy/tegra/phy-tegra194-p2u.c
> index 7042bed9feaa..42394d27f4cb 100644
> --- a/drivers/phy/tegra/phy-tegra194-p2u.c
> +++ b/drivers/phy/tegra/phy-tegra194-p2u.c
> @@ -92,10 +92,7 @@ static int tegra_p2u_probe(struct platform_device *pdev)
>   	phy_set_drvdata(generic_phy, phy);
>   
>   	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> -	if (IS_ERR(phy_provider))
> -		return PTR_ERR(phy_provider);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(phy_provider);
>   }
Since PTR_ERR_OR_ZERO macro returns zero if input is valid, if some more code gets added in
future after this, then, they might have to change this back to what it is now.
So I ended up continuing with if(IS_ERR(...)) + PTR_ERR towards the end also.
Having said that, I'm fine with this change as well.

Reviewed-by: Vidya Sagar <vidyas@nvidia.com>

>   
>   static const struct of_device_id tegra_p2u_id_table[] = {
> 
> 
> 
> 
> 


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

end of thread, other threads:[~2019-08-23  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  6:34 [PATCH -next] phy: tegra: Use PTR_ERR_OR_ZERO in tegra_p2u_probe() YueHaibing
2019-08-23  7:04 ` Vidya Sagar

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