]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/dp/mst: Fix off-by-one typo when dump payload table
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 19 Mar 2018 14:19:32 +0000 (16:19 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Mar 2019 13:20:54 +0000 (14:20 +0100)
BugLink: http://bugs.launchpad.net/bugs/1815234
[ Upstream commit 7056a2bccc3b5afc51f9b35b30a46f0d9219968d ]

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>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180319141932.37290-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/drm_dp_mst_topology.c

index 70dcfa58d3c22bb7156c6ecc1b41dc602ec198ba..09ac83add7157c3d1f0a1472764d007ed43b33e7 100644 (file)
@@ -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)
@@ -3010,7 +3012,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
        mutex_lock(&mgr->lock);
        if (mgr->mst_primary) {
-               u8 buf[64];
+               u8 buf[DP_PAYLOAD_TABLE_SIZE];
                int ret;
 
                ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
@@ -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);