From: Chen-Yu Tsai <wens@csie.org>
To: Maxime Ripard <maxime.ripard@free-electrons.com>,
David Airlie <airlied@linux.ie>
Cc: Chen-Yu Tsai <wens@csie.org>,
dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 7/7] drm/sun4i: Make sun4i_crtc_init return ERR_PTR style error codes
Date: Fri, 17 Feb 2017 11:13:30 +0800 [thread overview]
Message-ID: <20170217031330.14087-8-wens@csie.org> (raw)
In-Reply-To: <20170217031330.14087-1-wens@csie.org>
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>
---
drivers/gpu/drm/sun4i/sun4i_crtc.c | 4 ++--
drivers/gpu/drm/sun4i/sun4i_drv.c | 4 ++--
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 4a192210574f..4e2e89c3104f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -121,7 +121,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
if (!scrtc)
- return NULL;
+ return ERR_PTR(-ENOMEM);
scrtc->drv = drv;
ret = drm_crtc_init_with_planes(drm, &scrtc->crtc,
@@ -131,7 +131,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
NULL);
if (ret) {
dev_err(drm->dev, "Couldn't init DRM CRTC\n");
- return NULL;
+ return ERR_PTR(ret);
}
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 63c46643fdd1..fc6ef4066c59 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -153,9 +153,9 @@ static int sun4i_drv_bind(struct device *dev)
/* Create our CRTC */
drv->crtc = sun4i_crtc_init(drm);
- if (!drv->crtc) {
+ if (IS_ERR(drv->crtc)) {
dev_err(drm->dev, "Couldn't create the CRTC\n");
- ret = -EINVAL;
+ ret = PTR_ERR(drv->crtc);
goto cleanup_mode_config;
}
drm->irq_enabled = true;
--
2.11.0
next prev parent reply other threads:[~2017-02-17 3:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 3:13 [PATCH 0/7] drm/sun4i: Various fixes and cleanups part 1 Chen-Yu Tsai
2017-02-17 3:13 ` [PATCH 1/7] drm/sun4i: Move drm_mode_config_cleanup call to main driver Chen-Yu Tsai
2017-02-21 20:19 ` Maxime Ripard
2017-02-17 3:13 ` [PATCH 2/7] drm/sun4i: Fix up error path cleanup for master bind function Chen-Yu Tsai
2017-02-21 20:20 ` Maxime Ripard
2017-02-17 3:13 ` [PATCH 3/7] drm/sun4i: Check return value of drm_vblank_init Chen-Yu Tsai
2017-02-21 22:11 ` Maxime Ripard
2017-02-17 3:13 ` [PATCH 4/7] drm/sun4i: Fix kcalloc element size in sun4i_layers_init Chen-Yu Tsai
2017-02-21 22:12 ` Maxime Ripard
2017-02-17 3:13 ` [PATCH 5/7] drm/sun4i: Drop useless assignment " Chen-Yu Tsai
2017-02-21 22:12 ` Maxime Ripard
2017-02-17 3:13 ` [PATCH 6/7] drm/sun4i: Save newly created layer in layers array " Chen-Yu Tsai
2017-02-21 22:12 ` Maxime Ripard
2017-02-17 3:13 ` Chen-Yu Tsai [this message]
2017-02-21 22:13 ` [PATCH 7/7] drm/sun4i: Make sun4i_crtc_init return ERR_PTR style error codes Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170217031330.14087-8-wens@csie.org \
--to=wens@csie.org \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=maxime.ripard@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®