Commit e21c3adc authored by Lyude Paul's avatar Lyude Paul
Browse files

drm/display/dp_mst: Don't validate port refs in drm_dp_check_and_send_link_address()



Drive-by cleanup, we don't need to validate the port references here as we
already previously went through the effort of refactoring things such that
we're guaranteed to be able to access ->mstb and ->port safely from
drm_dp_check_and_send_link_address(), since the only two places in the
codebase that drop an MST reference in such a way that it would remove it
from the topology are both protected under probe_lock.

Thanks for that, past Lyude!

Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarWayne Lin <Wayne.Lin@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220602201757.30431-2-lyude@redhat.com
parent e1b7234b
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -2667,25 +2667,15 @@ static int drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *mg
	}

	list_for_each_entry(port, &mstb->ports, next) {
		struct drm_dp_mst_branch *mstb_child = NULL;

		if (port->input || !port->ddps)
		if (port->input || !port->ddps || !port->mstb)
			continue;

		if (port->mstb)
			mstb_child = drm_dp_mst_topology_get_mstb_validated(
			    mgr, port->mstb);

		if (mstb_child) {
			ret = drm_dp_check_and_send_link_address(mgr,
								 mstb_child);
			drm_dp_mst_topology_put_mstb(mstb_child);
		ret = drm_dp_check_and_send_link_address(mgr, port->mstb);
		if (ret == 1)
			changed = true;
		else if (ret < 0)
			return ret;
	}
	}

	return changed;
}