From: Thierry Escande <thierry.escande-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Archit Taneja <architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Daniel Vetter
<daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Neil Armstrong
<narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
Sandy Huang <hjc-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v8 3/8] drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register()
Date: Wed, 10 Jan 2018 17:23:43 +0100 [thread overview]
Message-ID: <20180110162348.22765-4-thierry.escande@collabora.com> (raw)
In-Reply-To: <20180110162348.22765-1-thierry.escande-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
From: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
The rockchip_drm_psr_register() can fail, so add a sanity check for that.
Also reorder the calls in unbind() to match bind().
Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Signed-off-by: Thierry Escande <thierry.escande-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
---
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 37250ab63bd7..eb88c52336a7 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -354,15 +354,22 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
INIT_WORK(&dp->psr_work, analogix_dp_psr_work);
- rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set);
+ ret = rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set);
+ if (ret < 0)
+ goto err_cleanup_encoder;
dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
if (IS_ERR(dp->adp)) {
- dp->encoder.funcs->destroy(&dp->encoder);
- return PTR_ERR(dp->adp);
+ ret = PTR_ERR(dp->adp);
+ goto err_unreg_psr;
}
return 0;
+err_unreg_psr:
+ rockchip_drm_psr_unregister(&dp->encoder);
+err_cleanup_encoder:
+ dp->encoder.funcs->destroy(&dp->encoder);
+ return ret;
}
static void rockchip_dp_unbind(struct device *dev, struct device *master,
@@ -370,8 +377,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master,
{
struct rockchip_dp_device *dp = dev_get_drvdata(dev);
- rockchip_drm_psr_unregister(&dp->encoder);
analogix_dp_unbind(dp->adp);
+ rockchip_drm_psr_unregister(&dp->encoder);
dp->encoder.funcs->destroy(&dp->encoder);
}
--
2.14.1
next prev parent reply other threads:[~2018-01-10 16:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 16:23 [PATCH v8 0/8] rockchip: kevin: Enable edp display Thierry Escande
[not found] ` <20180110162348.22765-1-thierry.escande-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-01-10 16:23 ` [PATCH v8 1/8] drm/bridge: analogix: Do not use device's drvdata Thierry Escande
2018-03-01 15:39 ` Heiko Stübner
2018-01-10 16:23 ` [PATCH v8 2/8] drm/bridge: analogix_dp: Fix connector and encoder cleanup Thierry Escande
2018-03-01 15:39 ` Heiko Stübner
2018-01-10 16:23 ` Thierry Escande [this message]
2018-03-01 15:25 ` [PATCH] drm/rockchip: analogix_dp: reorder psr_unregister call in unbind Heiko Stuebner
2018-03-01 15:41 ` [PATCH v8 3/8] drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register() Heiko Stübner
2018-01-10 16:23 ` [PATCH v8 4/8] drm/rockchip: dw-mipi-dsi: Fix error handling path Thierry Escande
2018-03-01 15:50 ` Heiko Stübner
2018-03-02 12:09 ` Enric Balletbo i Serra
2018-03-02 12:17 ` Heiko Stuebner
2018-03-02 12:22 ` Enric Balletbo i Serra
2018-01-10 16:23 ` [PATCH v8 5/8] drm/rockchip: inno_hdmi: " Thierry Escande
2018-01-10 16:23 ` [PATCH v8 6/8] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach Thierry Escande
2018-01-10 16:23 ` [PATCH v8 7/8] drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata Thierry Escande
2018-03-01 15:45 ` Heiko Stübner
2018-01-10 16:23 ` [PATCH v8 8/8] drm/rockchip: dw_hdmi: Fix error handling path Thierry Escande
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=20180110162348.22765-4-thierry.escande@collabora.com \
--to=thierry.escande-zgy8ohtn/8qb+jhodadfcq@public.gmane.org \
--cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=hjc-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
/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