[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230924064159.14739-1-liuhaoran14@163.com>
Date: Sun, 24 Sep 2023 14:41:59 +0800
From: liuhaoran <liuhaoran14@....com>
To: robdclark@...il.com
Cc: quic_abhinavk@...cinc.com, airlied@...il.com, daniel@...ll.ch,
linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
liuhaoran <liuhaoran14@....com>
Subject: [PATCH] drm/msm/mdp4: Add error handling in mdp4_lvds_connector_init()
This patch adds error-handling for the drm_connector_init() and
drm_connector_attach_encoder inside the mdp4_lvds_connector_init().
Signed-off-by: liuhaoran <liuhaoran14@....com>
---
.../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
index 7444b75c4215..62eb363ba90f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
@@ -96,6 +96,7 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
{
struct drm_connector *connector = NULL;
struct mdp4_lvds_connector *mdp4_lvds_connector;
+ int ret;
mdp4_lvds_connector = kzalloc(sizeof(*mdp4_lvds_connector), GFP_KERNEL);
if (!mdp4_lvds_connector)
@@ -106,8 +107,12 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
connector = &mdp4_lvds_connector->base;
- drm_connector_init(dev, connector, &mdp4_lvds_connector_funcs,
- DRM_MODE_CONNECTOR_LVDS);
+ ret = drm_connector_init(dev, connector, &mdp4_lvds_connector_funcs,
+ DRM_MODE_CONNECTOR_LVDS);
+
+ if (ret)
+ return ret;
+
drm_connector_helper_add(connector, &mdp4_lvds_connector_helper_funcs);
connector->polled = 0;
@@ -115,7 +120,10 @@ struct drm_connector *mdp4_lvds_connector_init(struct drm_device *dev,
connector->interlace_allowed = 0;
connector->doublescan_allowed = 0;
- drm_connector_attach_encoder(connector, encoder);
+ ret = drm_connector_attach_encoder(connector, encoder);
+
+ if (ret)
+ return ret;
return connector;
}
--
2.17.1
Powered by blists - more mailing lists