All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/i915: fix a read size argument
@ 2016-10-13  8:55 ` Dan Carpenter
  0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:55 UTC (permalink / raw)
  To: Daniel Vetter, Ville Syrjälä
  Cc: Jani Nikula, David Airlie, intel-gfx, dri-devel, linux-kernel,
	kernel-janitors

We want to read 3 bytes here, but because the parenthesis are in the
wrong place we instead read:

	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)

which is one byte.

Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 14a3cf0..ee8aa95 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
 	/* Read the eDP Display control capabilities registers */
 	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
 	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
-			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
-			     sizeof(intel_dp->edp_dpcd)))
+			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
+			     sizeof(intel_dp->edp_dpcd))
 		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
 			      intel_dp->edp_dpcd);
 

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [patch] drm/i915: fix a read size argument
@ 2016-10-13  8:55 ` Dan Carpenter
  0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:55 UTC (permalink / raw)
  To: Daniel Vetter, Ville Syrjälä
  Cc: David Airlie, intel-gfx, kernel-janitors, linux-kernel, dri-devel

We want to read 3 bytes here, but because the parenthesis are in the
wrong place we instead read:

	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)

which is one byte.

Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 14a3cf0..ee8aa95 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
 	/* Read the eDP Display control capabilities registers */
 	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
 	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
-			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) =
-			     sizeof(intel_dp->edp_dpcd)))
+			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) =
+			     sizeof(intel_dp->edp_dpcd))
 		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
 			      intel_dp->edp_dpcd);
 

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [patch] drm/i915: fix a read size argument
@ 2016-10-13  8:55 ` Dan Carpenter
  0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:55 UTC (permalink / raw)
  To: Daniel Vetter, Ville Syrjälä
  Cc: David Airlie, intel-gfx, kernel-janitors, linux-kernel, dri-devel

We want to read 3 bytes here, but because the parenthesis are in the
wrong place we instead read:

	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)

which is one byte.

Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 14a3cf0..ee8aa95 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
 	/* Read the eDP Display control capabilities registers */
 	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
 	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
-			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
-			     sizeof(intel_dp->edp_dpcd)))
+			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
+			     sizeof(intel_dp->edp_dpcd))
 		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
 			      intel_dp->edp_dpcd);
 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Intel-gfx] [patch] drm/i915: fix a read size argument
  2016-10-13  8:55 ` Dan Carpenter
  (?)
@ 2016-10-13  9:01   ` Chris Wilson
  -1 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2016-10-13  9:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Daniel Vetter, Ville Syrjälä,
	David Airlie, intel-gfx, kernel-janitors, linux-kernel,
	dri-devel

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oops, does smatch catch this? I don't recall seeing the complaint in
recent runs?

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Intel-gfx] [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:01   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2016-10-13  9:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, intel-gfx, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oops, does smatch catch this? I don't recall seeing the complaint in
recent runs?

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:01   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2016-10-13  9:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, intel-gfx, kernel-janitors, linux-kernel,
	dri-devel, Daniel Vetter

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oops, does smatch catch this? I don't recall seeing the complaint in
recent runs?

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
  2016-10-13  8:55 ` Dan Carpenter
  (?)
@ 2016-10-13  9:07   ` Eric Engestrom
  -1 siblings, 0 replies; 17+ messages in thread
From: Eric Engestrom @ 2016-10-13  9:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Daniel Vetter, Ville Syrjälä,
	intel-gfx, kernel-janitors, linux-kernel, dri-devel

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch!  What tool did you use to find it, or did you find it by
inspection?
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

(btw, there's a missing `---` here, between the commit msg and the diff)

> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
> +			     sizeof(intel_dp->edp_dpcd))
>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:07   ` Eric Engestrom
  0 siblings, 0 replies; 17+ messages in thread
From: Eric Engestrom @ 2016-10-13  9:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel, Daniel Vetter

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch!  What tool did you use to find it, or did you find it by
inspection?
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

(btw, there's a missing `---` here, between the commit msg and the diff)

> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) =
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) =
> +			     sizeof(intel_dp->edp_dpcd))
>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:07   ` Eric Engestrom
  0 siblings, 0 replies; 17+ messages in thread
From: Eric Engestrom @ 2016-10-13  9:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel, Daniel Vetter

On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch!  What tool did you use to find it, or did you find it by
inspection?
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

(btw, there's a missing `---` here, between the commit msg and the diff)

> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
> +			     sizeof(intel_dp->edp_dpcd))
>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
  2016-10-13  8:55 ` Dan Carpenter
  (?)
@ 2016-10-13  9:27   ` walter harms
  -1 siblings, 0 replies; 17+ messages in thread
From: walter harms @ 2016-10-13  9:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Daniel Vetter, Ville Syrjälä,
	Jani Nikula, David Airlie, intel-gfx, dri-devel, linux-kernel,
	kernel-janitors



Am 13.10.2016 10:55, schrieb Dan Carpenter:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
> +			     sizeof(intel_dp->edp_dpcd))



perhaps we can morph that into something more readable ? I would suggest:


if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
  {
    size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
    int ret;	

    ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	

    if (ret != size )
        ......

 }

this way it improves readability and reduces line length.


>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:27   ` walter harms
  0 siblings, 0 replies; 17+ messages in thread
From: walter harms @ 2016-10-13  9:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel, Daniel Vetter



Am 13.10.2016 10:55, schrieb Dan Carpenter:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) =
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) =
> +			     sizeof(intel_dp->edp_dpcd))



perhaps we can morph that into something more readable ? I would suggest:


if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
  {
    size_t size=sizeof(intel_dp->edp_dpcd); /* = EDP_DISPLAY_CTL_CAP_SIZE */
    int ret;	

    ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	

    if (ret != size )
        ......

 }

this way it improves readability and reduces line length.


>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:27   ` walter harms
  0 siblings, 0 replies; 17+ messages in thread
From: walter harms @ 2016-10-13  9:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel, Daniel Vetter



Am 13.10.2016 10:55, schrieb Dan Carpenter:
> We want to read 3 bytes here, but because the parenthesis are in the
> wrong place we instead read:
> 
> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> 
> which is one byte.
> 
> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 14a3cf0..ee8aa95 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  	/* Read the eDP Display control capabilities registers */
>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
> -			     sizeof(intel_dp->edp_dpcd)))
> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
> +			     sizeof(intel_dp->edp_dpcd))



perhaps we can morph that into something more readable ? I would suggest:


if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
  {
    size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
    int ret;	

    ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	

    if (ret != size )
        ......

 }

this way it improves readability and reduces line length.


>  		DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
>  			      intel_dp->edp_dpcd);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Intel-gfx] [patch] drm/i915: fix a read size argument
  2016-10-13  9:01   ` [Intel-gfx] " Chris Wilson
@ 2016-10-13  9:58     ` Dan Carpenter
  -1 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2016-10-13  9:58 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Ville Syrjälä,
	David Airlie, intel-gfx, kernel-janitors, linux-kernel,
	dri-devel

On Thu, Oct 13, 2016 at 10:01:03AM +0100, Chris Wilson wrote:
> On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> > We want to read 3 bytes here, but because the parenthesis are in the
> > wrong place we instead read:
> > 
> > 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
> > 
> > which is one byte.
> > 
> > Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Oops, does smatch catch this?

Yeah.  It does.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Intel-gfx] [patch] drm/i915: fix a read size argument
@ 2016-10-13  9:58     ` Dan Carpenter
  0 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2016-10-13  9:58 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Ville Syrjälä,
	David Airlie, intel-gfx, kernel-janitors, linux-kernel,
	dri-devel

On Thu, Oct 13, 2016 at 10:01:03AM +0100, Chris Wilson wrote:
> On Thu, Oct 13, 2016 at 11:55:08AM +0300, Dan Carpenter wrote:
> > We want to read 3 bytes here, but because the parenthesis are in the
> > wrong place we instead read:
> > 
> > 	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
> > 
> > which is one byte.
> > 
> > Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Oops, does smatch catch this?

Yeah.  It does.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
  2016-10-13  9:27   ` walter harms
  (?)
@ 2016-10-13 12:13     ` Jani Nikula
  -1 siblings, 0 replies; 17+ messages in thread
From: Jani Nikula @ 2016-10-13 12:13 UTC (permalink / raw)
  To: wharms, Dan Carpenter
  Cc: Daniel Vetter, Ville Syrjälä,
	David Airlie, intel-gfx, dri-devel, linux-kernel,
	kernel-janitors, drm-intel-fixes

On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>> 
>> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
>> 
>> which is one byte.
>> 
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Dan, good catch, thank you. Luckily we only really use the first byte
currently...

Cc: <drm-intel-fixes@lists.freedesktop.org>

>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>>  	/* Read the eDP Display control capabilities registers */
>>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
>> -			     sizeof(intel_dp->edp_dpcd)))
>> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
>> +			     sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
>   {
>     size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
>     int ret;	
>
>     ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	
>
>     if (ret != size )
>         ......
>
>  }
>
> this way it improves readability and reduces line length.

Not convinced, let's just take the simple brace fix now.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13 12:13     ` Jani Nikula
  0 siblings, 0 replies; 17+ messages in thread
From: Jani Nikula @ 2016-10-13 12:13 UTC (permalink / raw)
  To: wharms, Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel,
	drm-intel-fixes, Daniel Vetter

On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>> 
>> 	sizeof(intel_dp->edp_dpcd) = sizeof(intel_dp->edp_dpcd)
>> 
>> which is one byte.
>> 
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Dan, good catch, thank you. Luckily we only really use the first byte
currently...

Cc: <drm-intel-fixes@lists.freedesktop.org>

>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>>  	/* Read the eDP Display control capabilities registers */
>>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) =
>> -			     sizeof(intel_dp->edp_dpcd)))
>> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) =
>> +			     sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
>   {
>     size_t size=sizeof(intel_dp->edp_dpcd); /* = EDP_DISPLAY_CTL_CAP_SIZE */
>     int ret;	
>
>     ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	
>
>     if (ret != size )
>         ......
>
>  }
>
> this way it improves readability and reduces line length.

Not convinced, let's just take the simple brace fix now.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [patch] drm/i915: fix a read size argument
@ 2016-10-13 12:13     ` Jani Nikula
  0 siblings, 0 replies; 17+ messages in thread
From: Jani Nikula @ 2016-10-13 12:13 UTC (permalink / raw)
  To: wharms, Dan Carpenter
  Cc: intel-gfx, kernel-janitors, linux-kernel, dri-devel,
	drm-intel-fixes, Daniel Vetter

On Thu, 13 Oct 2016, walter harms <wharms@bfs.de> wrote:
> Am 13.10.2016 10:55, schrieb Dan Carpenter:
>> We want to read 3 bytes here, but because the parenthesis are in the
>> wrong place we instead read:
>> 
>> 	sizeof(intel_dp->edp_dpcd) == sizeof(intel_dp->edp_dpcd)
>> 
>> which is one byte.
>> 
>> Fixes: fe5a66f91c88 ("drm/i915: Read PSR caps/intermediate freqs/etc. only once on eDP")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Dan, good catch, thank you. Luckily we only really use the first byte
currently...

Cc: <drm-intel-fixes@lists.freedesktop.org>

>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 14a3cf0..ee8aa95 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -3551,8 +3551,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>>  	/* Read the eDP Display control capabilities registers */
>>  	if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
>>  	    drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
>> -			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) ==
>> -			     sizeof(intel_dp->edp_dpcd)))
>> +			     intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
>> +			     sizeof(intel_dp->edp_dpcd))
>
>
>
> perhaps we can morph that into something more readable ? I would suggest:
>
>
> if (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE)
>   {
>     size_t size=sizeof(intel_dp->edp_dpcd); /* == EDP_DISPLAY_CTL_CAP_SIZE */
>     int ret;	
>
>     ret=drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,intel_dp->edp_dpcd,size);	
>
>     if (ret != size )
>         ......
>
>  }
>
> this way it improves readability and reduces line length.

Not convinced, let's just take the simple brace fix now.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-10-13 12:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13  8:55 [patch] drm/i915: fix a read size argument Dan Carpenter
2016-10-13  8:55 ` Dan Carpenter
2016-10-13  8:55 ` Dan Carpenter
2016-10-13  9:01 ` [Intel-gfx] " Chris Wilson
2016-10-13  9:01   ` Chris Wilson
2016-10-13  9:01   ` [Intel-gfx] " Chris Wilson
2016-10-13  9:58   ` Dan Carpenter
2016-10-13  9:58     ` Dan Carpenter
2016-10-13  9:07 ` Eric Engestrom
2016-10-13  9:07   ` Eric Engestrom
2016-10-13  9:07   ` Eric Engestrom
2016-10-13  9:27 ` walter harms
2016-10-13  9:27   ` walter harms
2016-10-13  9:27   ` walter harms
2016-10-13 12:13   ` Jani Nikula
2016-10-13 12:13     ` Jani Nikula
2016-10-13 12:13     ` Jani Nikula

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.