> -----Original Message----- > From: Lyude Paul <lyude@xxxxxxxxxx> > Sent: Tuesday, December 3, 2019 8:23 AM > To: Lin, Wayne <Wayne.Lin@xxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx; > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Kazlauskas, Nicholas <Nicholas.Kazlauskas@xxxxxxx>; Wentland, Harry > <Harry.Wentland@xxxxxxx>; Zuo, Jerry <Jerry.Zuo@xxxxxxx> > Subject: Re: [PATCH] drm/dp_mst: Correct the bug in > drm_dp_update_payload_part1() > > On Mon, 2019-12-02 at 11:58 +0800, Wayne Lin wrote: > > [Why] > > If the payload_state is DP_PAYLOAD_DELETE_LOCAL in series, current > > code doesn't delete the payload at current index and just move the > > index to next one after shuffling payloads. > > > > [How] > > After shuffling payloads, decide whether to move on index or not > > according to payload_state of current payload. > > > > Signed-off-by: Wayne Lin <Wayne.Lin@xxxxxxx> > > --- > > drivers/gpu/drm/drm_dp_mst_topology.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c > > b/drivers/gpu/drm/drm_dp_mst_topology.c > > index 81e92b260d7a..8da5d461ea01 100644 > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c > > @@ -3176,7 +3176,8 @@ int drm_dp_update_payload_part1(struct > > drm_dp_mst_topology_mgr *mgr) > > drm_dp_mst_topology_put_port(port); > > } > > > > - for (i = 0; i < mgr->max_payloads; i++) { > > + for (i = 0; i < mgr->max_payloads; > > + (mgr->payloads[i].payload_state == DP_PAYLOAD_DELETE_LOCAL) ? > > i : i++) { > > Took me a moment to figure out what this line was actually doing. Nice catch > by the way! > > Anyway: let's just drop this line to avoid making things confusing to read, drop > i++ from the for loop instead, and just rewrite it so it looks like this: > > for (i = 0; i < mgr->max_payloads; /* do nothing */) { > if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) { > i++; > continue; > } > > With those changes, this patch is: > > Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx> > Thanks for your time and sorry for not well organized code. I will send you the v2 right away. Thanks! > I can go ahead and push these patches to drm-misc for you once you've sent > me the v2 > > if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) > > continue; > > > -- > Cheers, > Lyude Paul -- BR, Wayne Lin _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel