Commit 6f081dbf authored by Chris Wilson's avatar Chris Wilson

drm/i915/display: Fix early deref of 'dsb'

drivers/gpu/drm/i915/display/intel_dsb.c:177 intel_dsb_reg_write() warn: variable dereferenced before check 'dsb' (see line 175)

Fixes: afeda4f3 ("drm/i915/dsb: Pre allocate and late cleanup of cmd buffer")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Animesh Manna <animesh.manna@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: default avatarAnimesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200524233900.25598-1-chris@chris-wilson.co.uk
parent bf0840cd
...@@ -169,15 +169,17 @@ void intel_dsb_indexed_reg_write(const struct intel_crtc_state *crtc_state, ...@@ -169,15 +169,17 @@ void intel_dsb_indexed_reg_write(const struct intel_crtc_state *crtc_state,
void intel_dsb_reg_write(const struct intel_crtc_state *crtc_state, void intel_dsb_reg_write(const struct intel_crtc_state *crtc_state,
i915_reg_t reg, u32 val) i915_reg_t reg, u32 val)
{ {
struct intel_dsb *dsb = crtc_state->dsb;
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
u32 *buf = dsb->cmd_buf; struct intel_dsb *dsb;
u32 *buf;
dsb = crtc_state->dsb;
if (!dsb) { if (!dsb) {
intel_de_write(dev_priv, reg, val); intel_de_write(dev_priv, reg, val);
return; return;
} }
buf = dsb->cmd_buf; buf = dsb->cmd_buf;
if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) { if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n"); drm_dbg_kms(&dev_priv->drm, "DSB buffer overflow\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment