All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table
@ 2018-01-11 15:33 Andy Shevchenko
  2018-03-16 14:22 ` Andy Shevchenko
  2018-03-19 13:48 ` Daniel Vetter
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-11 15:33 UTC (permalink / raw)
  To: Gustavo Padovan, Daniel Vetter, dri-devel; +Cc: Dave Airlie, Andy Shevchenko

It seems there is a classical off-by-one typo from the beginning
when commit

  ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")

introduced a new helper.

Fix a typo by introducing a macro constant.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 70dcfa58d3c2..51c5fc11f852 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2936,12 +2936,14 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
 	}
 }
 
+#define DP_PAYLOAD_TABLE_SIZE		64
+
 static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,
 				  char *buf)
 {
 	int i;
 
-	for (i = 0; i < 64; i += 16) {
+	for (i = 0; i < DP_PAYLOAD_TABLE_SIZE; i += 16) {
 		if (drm_dp_dpcd_read(mgr->aux,
 				     DP_PAYLOAD_TABLE_UPDATE_STATUS + i,
 				     &buf[i], 16) != 16)
@@ -3028,8 +3030,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 		seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n",
 			   buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]);
 		if (dump_dp_payload_table(mgr, buf))
-			seq_printf(m, "payload table: %*ph\n", 63, buf);
-
+			seq_printf(m, "payload table: %*ph\n", DP_PAYLOAD_TABLE_SIZE, buf);
 	}
 
 	mutex_unlock(&mgr->lock);
-- 
2.15.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table
  2018-01-11 15:33 [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table Andy Shevchenko
@ 2018-03-16 14:22 ` Andy Shevchenko
  2018-03-19 13:48 ` Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-03-16 14:22 UTC (permalink / raw)
  To: Gustavo Padovan, Daniel Vetter, dri-devel; +Cc: Dave Airlie

On Thu, 2018-01-11 at 17:33 +0200, Andy Shevchenko wrote:
> It seems there is a classical off-by-one typo from the beginning
> when commit
> 
>   ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper
> (v0.6)")
> 
> introduced a new helper.
> 
> Fix a typo by introducing a macro constant.

Any comment on this?

> 
> Cc: Dave Airlie <airlied@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 70dcfa58d3c2..51c5fc11f852 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2936,12 +2936,14 @@ static void drm_dp_mst_dump_mstb(struct
> seq_file *m,
>  	}
>  }
>  
> +#define DP_PAYLOAD_TABLE_SIZE		64
> +
>  static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr
> *mgr,
>  				  char *buf)
>  {
>  	int i;
>  
> -	for (i = 0; i < 64; i += 16) {
> +	for (i = 0; i < DP_PAYLOAD_TABLE_SIZE; i += 16) {
>  		if (drm_dp_dpcd_read(mgr->aux,
>  				     DP_PAYLOAD_TABLE_UPDATE_STATUS +
> i,
>  				     &buf[i], 16) != 16)
> @@ -3028,8 +3030,7 @@ void drm_dp_mst_dump_topology(struct seq_file
> *m,
>  		seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n",
>  			   buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa],
> buf[0xb]);
>  		if (dump_dp_payload_table(mgr, buf))
> -			seq_printf(m, "payload table: %*ph\n", 63,
> buf);
> -
> +			seq_printf(m, "payload table: %*ph\n",
> DP_PAYLOAD_TABLE_SIZE, buf);
>  	}
>  
>  	mutex_unlock(&mgr->lock);

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table
  2018-01-11 15:33 [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table Andy Shevchenko
  2018-03-16 14:22 ` Andy Shevchenko
@ 2018-03-19 13:48 ` Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2018-03-19 13:48 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Dave Airlie, dri-devel, Daniel Vetter

On Thu, Jan 11, 2018 at 05:33:03PM +0200, Andy Shevchenko wrote:
> It seems there is a classical off-by-one typo from the beginning
> when commit
> 
>   ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")
> 
> introduced a new helper.
> 
> Fix a typo by introducing a macro constant.
> 
> Cc: Dave Airlie <airlied@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 70dcfa58d3c2..51c5fc11f852 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2936,12 +2936,14 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
>  	}
>  }
>  
> +#define DP_PAYLOAD_TABLE_SIZE		64
> +
>  static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,
>  				  char *buf)
>  {
>  	int i;
>  
> -	for (i = 0; i < 64; i += 16) {
> +	for (i = 0; i < DP_PAYLOAD_TABLE_SIZE; i += 16) {
>  		if (drm_dp_dpcd_read(mgr->aux,
>  				     DP_PAYLOAD_TABLE_UPDATE_STATUS + i,
>  				     &buf[i], 16) != 16)
> @@ -3028,8 +3030,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,

There's a u8 buf[64] a few lines above, can you pls convert that one too
to the new #define?

With that this looks good to me.
-Daniel

>  		seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n",
>  			   buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]);
>  		if (dump_dp_payload_table(mgr, buf))
> -			seq_printf(m, "payload table: %*ph\n", 63, buf);
> -
> +			seq_printf(m, "payload table: %*ph\n", DP_PAYLOAD_TABLE_SIZE, buf);
>  	}
>  
>  	mutex_unlock(&mgr->lock);
> -- 
> 2.15.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-03-19 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 15:33 [PATCH v1] drm/dp/mst: Fix off-by-one typo when dump payload table Andy Shevchenko
2018-03-16 14:22 ` Andy Shevchenko
2018-03-19 13:48 ` Daniel Vetter

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.