All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Protect against wrong reg offset and warn.
Date: Tue, 11 Sep 2018 13:39:53 -0700	[thread overview]
Message-ID: <1536698393.2638.2.camel@intel.com> (raw)
In-Reply-To: <20180903051500.10766-1-rodrigo.vivi@intel.com>

Em Dom, 2018-09-02 às 22:15 -0700, Rodrigo Vivi escreveu:
> In case we forget to change intel_port_is_tc
> we would be trying to access registers with port == -1,
> i.e. PORT_TC_NONE, what would be wrong offset.
> 

There are some many things that would break if intel_port_is_tc() is
incorrect that we would have to add a few dozen more WARNs. Why add
this specific check at this specific case and not all other checks in
other possible cases that could break?


> So let's just add a protection and warn here.
> 
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index 436c22de33b6..6a93fa9bbbd9 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4886,6 +4886,9 @@ static bool icl_tc_port_connected(struct
> drm_i915_private *dev_priv,
>  	bool is_legacy, is_typec, is_tbt;
>  	u32 dpsp;
>  
> +	if (WARN_ON(tc_port == PORT_TC_NONE))
> +		return false;
> +
>  	is_legacy = I915_READ(SDEISR) & SDE_TC_HOTPLUG_ICP(tc_port);
>  
>  	/*
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-09-11 20:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03  5:15 [PATCH] drm/i915: Protect against wrong reg offset and warn Rodrigo Vivi
2018-09-03  5:38 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-09-03  6:27 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-11 20:39 ` Paulo Zanoni [this message]
2018-09-11 21:26   ` [PATCH] " Rodrigo Vivi
2018-09-11 21:44     ` Paulo Zanoni

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=1536698393.2638.2.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.