diff mbox

[1/2] drm/i915/skl: Fix always true comparison in a revision id check

Message ID 1423678904-23698-2-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Feb. 11, 2015, 6:21 p.m. UTC
It's always a good idea to keep static analysis happy (also because it
prompts doing the check like I proposed :), this time smatch complains:

drivers/gpu/drm/i915/intel_ringbuffer.c:891 gen9_init_workarounds() warn:
  always true condition '((->dev->pdev->revision) >= (0)) => (0-255 >= 0)'

That's because revision is a u8. Tweak a bit the condition then.

Cc: Nick Hoath <nicholas.hoath@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nick Hoath Feb. 12, 2015, 1:33 p.m. UTC | #1
On 11/02/2015 18:21, Lespiau, Damien wrote:
> It's always a good idea to keep static analysis happy (also because it
> prompts doing the check like I proposed :), this time smatch complains:
>
> drivers/gpu/drm/i915/intel_ringbuffer.c:891 gen9_init_workarounds() warn:
>    always true condition '((->dev->pdev->revision) >= (0)) => (0-255 >= 0)'
>
> That's because revision is a u8. Tweak a bit the condition then.
>
> Cc: Nick Hoath <nicholas.hoath@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

A bit contrived :) but:
Reviewed-by: Nick Hoath <nicholas.hoath@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 2060610..8735e56 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -957,8 +957,8 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
>   	WA_SET_BIT_MASKED(HALF_SLICE_CHICKEN3,
>   			  GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC);
>
> -	if (INTEL_REVID(dev) >= SKL_REVID_A0 &&
> -	    INTEL_REVID(dev) <= SKL_REVID_B0) {
> +	if (INTEL_REVID(dev) == SKL_REVID_A0 ||
> +	    INTEL_REVID(dev) == SKL_REVID_B0) {
>   		/*
>   		* WaDisableDgMirrorFixInHalfSliceChicken5:skl
>   		* This is a pre-production w/a.
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2060610..8735e56 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -957,8 +957,8 @@  static int gen9_init_workarounds(struct intel_engine_cs *ring)
 	WA_SET_BIT_MASKED(HALF_SLICE_CHICKEN3,
 			  GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC);
 
-	if (INTEL_REVID(dev) >= SKL_REVID_A0 &&
-	    INTEL_REVID(dev) <= SKL_REVID_B0) {
+	if (INTEL_REVID(dev) == SKL_REVID_A0 ||
+	    INTEL_REVID(dev) == SKL_REVID_B0) {
 		/*
 		* WaDisableDgMirrorFixInHalfSliceChicken5:skl
 		* This is a pre-production w/a.