]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/dp/mst: fix in MSTB RAD initialization
authorMykola Lysenko <Mykola.Lysenko@amd.com>
Fri, 25 Dec 2015 08:14:47 +0000 (16:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Jan 2016 17:09:01 +0000 (12:09 -0500)
This fix is needed to support more then two
branch displays, so RAD address consist at
least of 2 elements

Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/drm_dp_mst_topology.c

index ca92a3217465a75e3eb318e2f2087a0c0bf40691..d809ce8a4f28cc9f5c76ccd91abd2f74165a041d 100644 (file)
@@ -978,17 +978,17 @@ static struct drm_dp_mst_port *drm_dp_get_port(struct drm_dp_mst_branch *mstb, u
 static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
                                 u8 *rad)
 {
-       int lct = port->parent->lct;
+       int parent_lct = port->parent->lct;
        int shift = 4;
-       int idx = lct / 2;
-       if (lct > 1) {
-               memcpy(rad, port->parent->rad, idx);
-               shift = (lct % 2) ? 4 : 0;
+       int idx = (parent_lct - 1) / 2;
+       if (parent_lct > 1) {
+               memcpy(rad, port->parent->rad, idx + 1);
+               shift = (parent_lct % 2) ? 4 : 0;
        } else
                rad[0] = 0;
 
        rad[idx] |= port->port_num << shift;
-       return lct + 1;
+       return parent_lct + 1;
 }
 
 /*