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

From: liuhaoran
Date: Sun Sep 24 2023 - 03:49:43 EST


This patch adds error-handling for the drm_plane_create_alpha_property()
and drm_plane_create_zpos_property() inside the dw_hdmi_imx_probe().

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;
}
--
2.17.1