From: Matthias Kaehlcke <mka@chromium.org>
To: zijun_hu <zijun_hu@htc.com>, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Doug Anderson <dianders@chromium.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Greg Hackmann <ghackmann@google.com>,
Yury Norov <ynorov@caviumnetworks.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH v2] drm/rockchip: Skip suspend/resume if no display is attached
Date: Wed, 9 Aug 2017 16:05:43 -0700 [thread overview]
Message-ID: <20170809230543.GA109008@google.com> (raw)
In-Reply-To: <20170809230302.107975-1-mka@chromium.org>
El Wed, Aug 09, 2017 at 04:03:02PM -0700 Matthias Kaehlcke ha dit:
> rockchip_drm_sys_suspend/resume() obains a struct drm_device pointer
> from drvdata, the pointer is then dereferenced to obtain private data.
> drvdata is set when a display is bound, on systems without a
> (successfully probed) display drvdata is NULL and the PM functions
> try to dereference a NULL pointer.
>
> The suspend/resume code relies on a valid drm_device object, skip it if
> the pointer is NULL.
sorry for the noise, the recipient list was taken from the command
history in another tab, instead the one I intended :(
> ---
> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index c6b1b7f3a2a3..6228145d9496 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -275,11 +275,16 @@ static void rockchip_drm_fb_resume(struct drm_device *drm)
> static int rockchip_drm_sys_suspend(struct device *dev)
> {
> struct drm_device *drm = dev_get_drvdata(dev);
> - struct rockchip_drm_private *priv = drm->dev_private;
> + struct rockchip_drm_private *priv;
> +
> + if (!drm)
> + /* no display attached */
> + return 0;
>
> drm_kms_helper_poll_disable(drm);
> rockchip_drm_fb_suspend(drm);
>
> + priv = drm->dev_private;
> priv->state = drm_atomic_helper_suspend(drm);
> if (IS_ERR(priv->state)) {
> rockchip_drm_fb_resume(drm);
> @@ -293,8 +298,13 @@ static int rockchip_drm_sys_suspend(struct device *dev)
> static int rockchip_drm_sys_resume(struct device *dev)
> {
> struct drm_device *drm = dev_get_drvdata(dev);
> - struct rockchip_drm_private *priv = drm->dev_private;
> + struct rockchip_drm_private *priv;
> +
> + if (!drm)
> + /* no display attached */
> + return 0;
>
> + priv = drm->dev_private;
> drm_atomic_helper_resume(drm, priv->state);
> rockchip_drm_fb_resume(drm);
> drm_kms_helper_poll_enable(drm);
prev parent reply other threads:[~2017-08-09 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 23:03 Matthias Kaehlcke
2017-08-09 23:05 ` Matthias Kaehlcke [this message]
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=20170809230543.GA109008@google.com \
--to=mka@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=dianders@chromium.org \
--cc=ghackmann@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=ynorov@caviumnetworks.com \
--cc=zijun_hu@htc.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
Powered by JetHome