Message ID | 20250401103846.686408-1-imre.deak@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/2] drm/dp_mst: Fix GUID DPCD write to non-root MST branch devices | expand |
On Tue, 01 Apr 2025, Imre Deak <imre.deak@intel.com> wrote: > The return value on success of drm_dp_send_dpcd_write() called for > non-root MST branch devices from drm_dp_check_mstb_guid() is the number > of bytes transferred. Atm this return value (in case of a complete read) > will be regarded incorrectly as an error by the caller of > drm_dp_check_mstb_guid(). Fix this by converting the return value for a > complete read to the expected success code (0) and for a partial read to > a failure code (-EPROTO). > > Fixes: 2554da0de3e8 ("drm/display: dp-mst-topology: use new DCPD access helpers") > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > Cc: Lyude Paul <lyude@redhat.com> > Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> > --- > drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c > index de3fc6090c906..619f461e02f76 100644 > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c > @@ -2200,6 +2200,8 @@ static int drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, guid_t *guid) > ret = drm_dp_send_dpcd_write(mstb->mgr, > mstb->port_parent, > DP_GUID, sizeof(buf), buf); > + if (ret >= 0) > + ret = ret == sizeof(buf) ? 0 : -EPROTO; > } else { > ret = drm_dp_dpcd_write_data(mstb->mgr->aux, > DP_GUID, buf, sizeof(buf));
diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index de3fc6090c906..619f461e02f76 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -2200,6 +2200,8 @@ static int drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, guid_t *guid) ret = drm_dp_send_dpcd_write(mstb->mgr, mstb->port_parent, DP_GUID, sizeof(buf), buf); + if (ret >= 0) + ret = ret == sizeof(buf) ? 0 : -EPROTO; } else { ret = drm_dp_dpcd_write_data(mstb->mgr->aux, DP_GUID, buf, sizeof(buf));
The return value on success of drm_dp_send_dpcd_write() called for non-root MST branch devices from drm_dp_check_mstb_guid() is the number of bytes transferred. Atm this return value (in case of a complete read) will be regarded incorrectly as an error by the caller of drm_dp_check_mstb_guid(). Fix this by converting the return value for a complete read to the expected success code (0) and for a partial read to a failure code (-EPROTO). Fixes: 2554da0de3e8 ("drm/display: dp-mst-topology: use new DCPD access helpers") Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Lyude Paul <lyude@redhat.com> Signed-off-by: Imre Deak <imre.deak@intel.com> --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 ++ 1 file changed, 2 insertions(+)