[PATCH] drm/sun4i: Replace redundant return value judgment with PTR_ERR_OR_ZERO()

Maxime Ripard mripard at kernel.org
Wed Aug 20 08:00:13 PDT 2025


Hi,

On Fri, Aug 15, 2025 at 09:37:27PM +0800, Liao Yuanhong wrote:
> Replace redundant return value judgment with PTR_ERR_OR_ZERO() to
> enhance code readability.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong at vivo.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 5 +----
>  drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c     | 5 +----
>  drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c  | 5 +----
>  3 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> index fbf7da9d9592..c90dd0ad040f 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> @@ -229,8 +229,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);

The readibility improvement is very subjective, and this makes it harder
to extend later on, so I don't think this should be merged.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250820/058f4492/attachment.sig>


More information about the linux-arm-kernel mailing list