Message ID | 1574075093-37340-1-git-send-email-zhengbin13@huawei.com |
---|---|
State | Rejected |
Headers | show |
Series | phy: tegra: Use PTR_ERR_OR_ZERO() to simplify code | expand |
On Mon, Nov 18, 2019 at 07:04:53PM +0800, zhengbin wrote: > Fixes coccicheck warning: > > drivers/phy/tegra/phy-tegra194-p2u.c:95: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/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 7042bed..42394d2 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[] = { Sorry, but I don't see the advantage in this. Yes, this can save a couple of lines, but if we ever need to add additional code here it's going to lead to a much larger diff because we need to untangle this again. Also, and this is very subjective, the original is much easier to read and understand because it has a well-established structure. Thierry
diff --git a/drivers/phy/tegra/phy-tegra194-p2u.c b/drivers/phy/tegra/phy-tegra194-p2u.c index 7042bed..42394d2 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[] = {
Fixes coccicheck warning: drivers/phy/tegra/phy-tegra194-p2u.c:95: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/phy/tegra/phy-tegra194-p2u.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.7.4