diff mbox series

[PATCH-next] drm/sun4i: Use PTR_ERR_OR_ZERO in sun8i_phy_clk_create()

Message ID 20190203000622.30856-1-chrisadr@gentoo.org (mailing list archive)
State New, archived
Headers show
Series [PATCH-next] drm/sun4i: Use PTR_ERR_OR_ZERO in sun8i_phy_clk_create() | expand

Commit Message

Christopher Diaz Riveros Feb. 3, 2019, 12:06 a.m. UTC
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
---
 drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Chen-Yu Tsai Feb. 5, 2019, 3:08 p.m. UTC | #1
On Sun, Feb 3, 2019 at 8:07 AM Christopher Diaz Riveros
<chrisadr@gentoo.org> wrote:
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Maxime's reply to the patch "drm/sun4i: hdmi: Use PTR_ERR_OR_ZERO
in sun4i_tmds_create()" [1] probably applies to this one as well:

"""
While this is technically correct (and I appreciate that this is also
a matter of taste), I find the former syntax to be clearer and easier
to extend if needed.
"""

ChenYu

[1] https://patchwork.kernel.org/patch/10671757/
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
index a4d31fe3abff..d52f581797f0 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
@@ -171,8 +171,6 @@  int sun8i_phy_clk_create(struct sun8i_hdmi_phy *phy, struct device *dev,
 	priv->hw.init = &init;
 
 	phy->clk_phy = devm_clk_register(dev, &priv->hw);
-	if (IS_ERR(phy->clk_phy))
-		return PTR_ERR(phy->clk_phy);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(phy->clk_phy);
 }