* [PATCH -next] drm/sun4i: hdmi: Use PTR_ERR_OR_ZERO in sun4i_tmds_create()
@ 2018-11-07 2:34 YueHaibing
2018-11-14 14:49 ` Maxime Ripard
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-11-07 2:34 UTC (permalink / raw)
To: Maxime Ripard, David Airlie, Chen-Yu Tsai
Cc: YueHaibing, dri-devel, linux-arm-kernel, linux-kernel, kernel-janitors
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
index fb985ba..3d5ee6f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
@@ -232,8 +232,5 @@ int sun4i_tmds_create(struct sun4i_hdmi *hdmi)
tmds->div_offset = hdmi->variant->tmds_clk_div_offset;
hdmi->tmds_clk = devm_clk_register(hdmi->dev, &tmds->hw);
- if (IS_ERR(hdmi->tmds_clk))
- return PTR_ERR(hdmi->tmds_clk);
-
- return 0;
+ return PTR_ERR_OR_ZERO(hdmi->tmds_clk);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] drm/sun4i: hdmi: Use PTR_ERR_OR_ZERO in sun4i_tmds_create()
2018-11-07 2:34 [PATCH -next] drm/sun4i: hdmi: Use PTR_ERR_OR_ZERO in sun4i_tmds_create() YueHaibing
@ 2018-11-14 14:49 ` Maxime Ripard
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2018-11-14 14:49 UTC (permalink / raw)
To: YueHaibing
Cc: David Airlie, Chen-Yu Tsai, dri-devel, linux-arm-kernel,
linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
Hi!
On Wed, Nov 07, 2018 at 02:34:23AM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> index fb985ba..3d5ee6f 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> @@ -232,8 +232,5 @@ int sun4i_tmds_create(struct sun4i_hdmi *hdmi)
> tmds->div_offset = hdmi->variant->tmds_clk_div_offset;
>
> hdmi->tmds_clk = devm_clk_register(hdmi->dev, &tmds->hw);
> - if (IS_ERR(hdmi->tmds_clk))
> - return PTR_ERR(hdmi->tmds_clk);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(hdmi->tmds_clk);
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.
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-14 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 2:34 [PATCH -next] drm/sun4i: hdmi: Use PTR_ERR_OR_ZERO in sun4i_tmds_create() YueHaibing
2018-11-14 14:49 ` Maxime Ripard
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).