aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-02-16 22:13:30 -0500
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-03-07 16:15:15 -0500
commitea411fd2c8d5704fc247be106026d436d27c900f (patch)
tree9a14fd007a6d87af7ab5a7c75bcf4fa33a67a045
parent903795d60ffa89918b521064b0cbcba139ae4047 (diff)
drm/sun4i: Make sun4i_crtc_init return ERR_PTR style error codes
sun4i_crtc_init can fail for a number of reasons. Instead of returning a NULL pointer when it fails, pass back the encountered error using ERR_PTR. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c4
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index a5d546a68e16..7d332fce6770 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -145,7 +145,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
145 145
146 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL); 146 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
147 if (!scrtc) 147 if (!scrtc)
148 return NULL; 148 return ERR_PTR(-ENOMEM);
149 scrtc->drv = drv; 149 scrtc->drv = drv;
150 150
151 ret = drm_crtc_init_with_planes(drm, &scrtc->crtc, 151 ret = drm_crtc_init_with_planes(drm, &scrtc->crtc,
@@ -155,7 +155,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
155 NULL); 155 NULL);
156 if (ret) { 156 if (ret) {
157 dev_err(drm->dev, "Couldn't init DRM CRTC\n"); 157 dev_err(drm->dev, "Couldn't init DRM CRTC\n");
158 return NULL; 158 return ERR_PTR(ret);
159 } 159 }
160 160
161 drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs); 161 drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs);
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 46887c3044d0..9adf1263e1e3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -125,9 +125,9 @@ static int sun4i_drv_bind(struct device *dev)
125 125
126 /* Create our CRTC */ 126 /* Create our CRTC */
127 drv->crtc = sun4i_crtc_init(drm); 127 drv->crtc = sun4i_crtc_init(drm);
128 if (!drv->crtc) { 128 if (IS_ERR(drv->crtc)) {
129 dev_err(drm->dev, "Couldn't create the CRTC\n"); 129 dev_err(drm->dev, "Couldn't create the CRTC\n");
130 ret = -EINVAL; 130 ret = PTR_ERR(drv->crtc);
131 goto cleanup_mode_config; 131 goto cleanup_mode_config;
132 } 132 }
133 drm->irq_enabled = true; 133 drm->irq_enabled = true;