From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sean Paul <seanpaul@chromium.org>,
Sasha Levin <sashal@kernel.org>,
dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 4.19 083/258] drm: Move drm_mode_setcrtc() local re-init to failure path
Date: Mon, 28 Jan 2019 10:56:29 -0500 [thread overview]
Message-ID: <20190128155924.51521-83-sashal@kernel.org> (raw)
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Sean Paul <seanpaul@chromium.org>
[ Upstream commit c232e9f41b136c141df9938024e521191a7b910d ]
Instead of always re-initializing the variables we need to clean up on
out, move the re-initialization into the branch that goes back to retry
label.
This is a lateral move right now, but will allow us to pull out the
modeset locking into common code. I kept this change separate to make
things easier to review.
Changes in v2:
- None
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-2-sean@poorly.run
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/drm_crtc.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 9cbe8f5c9aca..ed9d7fc4cb2c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -567,9 +567,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
struct drm_mode_crtc *crtc_req = data;
struct drm_crtc *crtc;
struct drm_plane *plane;
- struct drm_connector **connector_set, *connector;
- struct drm_framebuffer *fb;
- struct drm_display_mode *mode;
+ struct drm_connector **connector_set = NULL, *connector;
+ struct drm_framebuffer *fb = NULL;
+ struct drm_display_mode *mode = NULL;
struct drm_mode_set set;
uint32_t __user *set_connectors_ptr;
struct drm_modeset_acquire_ctx ctx;
@@ -598,10 +598,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
mutex_lock(&crtc->dev->mode_config.mutex);
drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
- connector_set = NULL;
- fb = NULL;
- mode = NULL;
-
ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
if (ret)
goto out;
@@ -763,6 +759,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
}
kfree(connector_set);
drm_mode_destroy(dev, mode);
+
+ /* In case we need to retry... */
+ connector_set = NULL;
+ fb = NULL;
+ mode = NULL;
+
if (ret == -EDEADLK) {
ret = drm_modeset_backoff(&ctx);
if (!ret)
--
2.19.1
next prev parent reply other threads:[~2019-01-28 15:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 15:55 [PATCH AUTOSEL 4.19 001/258] drm/bufs: Fix Spectre v1 vulnerability Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 003/258] drm/vgem: Fix vgem_init to get drm device available Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 007/258] drm/sun4i: Initialize registers in tcon-top driver Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 009/258] gpu: ipu-v3: image-convert: Prevent race between run and unprepare Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 027/258] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 046/258] drm/rockchip: fix for mailbox read size Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 048/258] drm/amd/display: fix gamma not being applied correctly Sasha Levin
2019-01-28 15:55 ` [PATCH AUTOSEL 4.19 049/258] drm/amd/display: calculate stream->phy_pix_clk before clock mapping Sasha Levin
2019-01-28 15:56 ` [PATCH AUTOSEL 4.19 082/258] drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state() Sasha Levin
2019-01-28 15:56 ` Sasha Levin [this message]
2019-01-28 21:03 ` [PATCH AUTOSEL 4.19 083/258] drm: Move drm_mode_setcrtc() local re-init to failure path Sean Paul
2019-02-02 17:32 ` Sasha Levin
2019-01-28 15:56 ` [PATCH AUTOSEL 4.19 092/258] drm/v3d: Fix prime imports of buffers from other drivers Sasha Levin
2019-01-28 15:56 ` [PATCH AUTOSEL 4.19 109/258] drm/amdgpu/powerplay: fix clock stretcher limits on polaris (v2) Sasha Levin
[not found] ` <20190128155924.51521-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2019-01-28 15:57 ` [PATCH AUTOSEL 4.19 137/258] drm/msm/dsi: fix dsi clock names in DSI 10nm PLL driver Sasha Levin
2019-01-28 15:57 ` [PATCH AUTOSEL 4.19 138/258] drm/msm: dpu: Only check flush register against pending flushes Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 203/258] drm/amd/display: validate extended dongle caps Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 183/258] drm/amd/display: Add retry to read ddc_clock pin Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 185/258] drm/amd/display: fix YCbCr420 blank color Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 204/258] video: clps711x-fb: release disp device node in probe() Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 206/258] fbdev: fbmem: behave better with small rotated displays and many CPUs Sasha Levin
2019-01-28 15:58 ` [PATCH AUTOSEL 4.19 211/258] fbdev: fbcon: Fix unregister crash when more than one framebuffer Sasha Levin
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=20190128155924.51521-83-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanpaul@chromium.org \
--cc=stable@vger.kernel.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