mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
drm/dp_mst: Sanitize error return during payload addition
Return an error during payload addition if the payload port isn't found. This shouldn't change the behavior since only the i915 driver checks the return value, printing an error message in case of a failure. While at it simplify the control flow. Cc: Wayne Lin <Wayne.Lin@amd.com> Cc: Lyude Paul <lyude@redhat.com> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230913223218.540365-2-imre.deak@intel.com
This commit is contained in:
parent
47fadb03bd
commit
8bde4442ac
1 changed files with 12 additions and 14 deletions
|
@ -3308,8 +3308,7 @@ int drm_dp_add_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
|
|||
struct drm_dp_mst_atomic_payload *payload)
|
||||
{
|
||||
struct drm_dp_mst_port *port;
|
||||
int ret = 0;
|
||||
bool allocate = true;
|
||||
int ret;
|
||||
|
||||
/* Update mst mgr info */
|
||||
if (mgr->payload_count == 0)
|
||||
|
@ -3320,29 +3319,28 @@ int drm_dp_add_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
|
|||
mgr->payload_count++;
|
||||
mgr->next_start_slot += payload->time_slots;
|
||||
|
||||
payload->payload_allocation_status = DRM_DP_MST_PAYLOAD_ALLOCATION_LOCAL;
|
||||
|
||||
/* Allocate payload to immediate downstream facing port */
|
||||
port = drm_dp_mst_topology_get_port_validated(mgr, payload->port);
|
||||
if (!port) {
|
||||
drm_dbg_kms(mgr->dev,
|
||||
"VCPI %d for port %p not in topology, not creating a payload to remote\n",
|
||||
payload->vcpi, payload->port);
|
||||
allocate = false;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (allocate) {
|
||||
ret = drm_dp_create_payload_at_dfp(mgr, payload);
|
||||
if (ret < 0)
|
||||
drm_warn(mgr->dev, "Failed to create MST payload for port %p: %d\n",
|
||||
payload->port, ret);
|
||||
|
||||
ret = drm_dp_create_payload_at_dfp(mgr, payload);
|
||||
if (ret < 0) {
|
||||
drm_warn(mgr->dev, "Failed to create MST payload for port %p: %d\n",
|
||||
payload->port, ret);
|
||||
goto put_port;
|
||||
}
|
||||
|
||||
payload->payload_allocation_status =
|
||||
(!allocate || ret < 0) ? DRM_DP_MST_PAYLOAD_ALLOCATION_LOCAL :
|
||||
DRM_DP_MST_PAYLOAD_ALLOCATION_DFP;
|
||||
payload->payload_allocation_status = DRM_DP_MST_PAYLOAD_ALLOCATION_DFP;
|
||||
|
||||
if (port)
|
||||
drm_dp_mst_topology_put_port(port);
|
||||
put_port:
|
||||
drm_dp_mst_topology_put_port(port);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue