Re: [PATCH] drm/sun4i: Add error handling in sun4i_layer_init_one()

From: Jernej Škrabec
Date: Sun Sep 24 2023 - 15:47:41 EST


Hi!

Dne nedelja, 24. september 2023 ob 09:42:16 CEST je liuhaoran napisal(a):
> This patch adds error-handling for the drm_plane_create_alpha_property()
> and drm_plane_create_zpos_property() inside the dw_hdmi_imx_probe().

dw_hdmi_imx_probe() is not from this driver.

Best regards,
Jernej

>
> Signed-off-by: liuhaoran <liuhaoran14@xxxxxxx>
> ---
> drivers/gpu/drm/sun4i/sun4i_layer.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
> index 98f3176366c0..a3343afb7935 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
> @@ -224,9 +224,22 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
> drm_plane_helper_add(&layer->plane,
> &sun4i_backend_layer_helper_funcs);
>
> - drm_plane_create_alpha_property(&layer->plane);
> - drm_plane_create_zpos_property(&layer->plane, layer->id,
> - 0, SUN4I_BACKEND_NUM_LAYERS - 1);
> + ret = drm_plane_create_alpha_property(&layer->plane);
> +
> + if (ret) {
> + dev_err(drm->dev, "Failed to install alpha property,
> + rc = %d\n", ret);
> + return ERR_PTR(ret);
> + }
> +
> + ret = drm_plane_create_zpos_property(&layer->plane, layer->id, 0,
> + SUN4I_BACKEND_NUM_LAYERS - 1);
> +
> + if (ret) {
> + dev_err(drm->dev, "Failed to install zpos property,
> + rc = %d\n", ret);
> + return ERR_PTR(ret);
> + }
>
> return layer;
> }
>