On Thu, 10 Feb 2022, Simon Ser <contact@xxxxxxxxxxx> wrote: > drm_dp_dpcd_read returns the number of bytes read. The previous code > would print garbage on DPCD error, and would exit with on error on > success. Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> I do wish we'd just made dpcd access return 0 when the number of bytes transferred matches the request, and an error otherwise. BR, Jani. > > Signed-off-by: Simon Ser <contact@xxxxxxxxxxx> > Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") > Cc: Lyude Paul <lyude@xxxxxxxxxx> > Cc: Benjamin Gaignard <benjamin.gaignard@xxxxxx> > --- > drivers/gpu/drm/dp/drm_dp_mst_topology.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/dp/drm_dp_mst_topology.c b/drivers/gpu/drm/dp/drm_dp_mst_topology.c > index 11300b53d24f..f5998b7cf602 100644 > --- a/drivers/gpu/drm/dp/drm_dp_mst_topology.c > +++ b/drivers/gpu/drm/dp/drm_dp_mst_topology.c > @@ -4912,21 +4912,21 @@ void drm_dp_mst_dump_topology(struct seq_file *m, > int ret; > > ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE); > - if (ret) { > + if (ret != DP_RECEIVER_CAP_SIZE) { > seq_printf(m, "dpcd read failed\n"); > goto out; > } > seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); > > ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); > - if (ret) { > + if (ret != 2) { > seq_printf(m, "faux/mst read failed\n"); > goto out; > } > seq_printf(m, "faux/mst: %*ph\n", 2, buf); > > ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); > - if (ret) { > + if (ret != 1) { > seq_printf(m, "mst ctrl read failed\n"); > goto out; > } > @@ -4934,7 +4934,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, > > /* dump the standard OUI branch header */ > ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); > - if (ret) { > + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { > seq_printf(m, "branch oui read failed\n"); > goto out; > } > > base-commit: ded74cafeea9311c1eaf6fccce963de2516145f7 -- Jani Nikula, Intel Open Source Graphics Center