[Intel-gfx] [PATCH] drm/i915: check status and reply value both in skl_pcode_try_request()

Imre Deak imre.deak at intel.com
Wed Feb 22 07:54:16 UTC 2017


On Wed, Feb 22, 2017 at 10:25:44AM +0800, Weinan Li wrote:
> skl_pcode_try_request() call sandybridge_pcode_read(), check both return
> status and value simultanously, ensure it got correct value without error.
> 
> Signed-off-by: Weinan Li <weinan.z.li at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index ae2c0bb..e7b12ec 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -7882,7 +7882,7 @@ static bool skl_pcode_try_request(struct drm_i915_private *dev_priv, u32 mbox,
>  
>  	*status = sandybridge_pcode_read(dev_priv, mbox, &val);
>  
> -	return *status || ((val & reply_mask) == reply);
> +	return (!*status) && ((val & reply_mask) == reply);
>  }

The original looks ok to me. The condition becomes true if PCODE reports
an error in *status or we get the expected reply. *status is then
rechecked in skl_pcode_request().

--Imre

>  
>  /**
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list