Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f9ba199 authored by Grazvydas Ignotas's avatar Grazvydas Ignotas Committed by Alex Deucher
Browse files

drm/amdgpu: warn if dp aux is still attached on free



If this happens (and it recently did), we free a structure while part of
it is still in use, which results in non-obvious crashes. The way it's
detached is not trivial (DRM core has to call the connector .destroy
callback and things must be torn down in the right order), so better
detect it and warn early.

Signed-off-by: default avatarGrazvydas Ignotas <notasas@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 140c94da
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -769,8 +769,10 @@ static void amdgpu_connector_destroy(struct drm_connector *connector)
{
{
	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);


	if (amdgpu_connector->ddc_bus->has_aux)
	if (amdgpu_connector->ddc_bus->has_aux) {
		drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
		drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
		amdgpu_connector->ddc_bus->has_aux = false;
	}
	amdgpu_connector_free_edid(connector);
	amdgpu_connector_free_edid(connector);
	kfree(amdgpu_connector->con_priv);
	kfree(amdgpu_connector->con_priv);
	drm_connector_unregister(connector);
	drm_connector_unregister(connector);
+1 −0
Original line number Original line Diff line number Diff line
@@ -220,6 +220,7 @@ void amdgpu_i2c_destroy(struct amdgpu_i2c_chan *i2c)
{
{
	if (!i2c)
	if (!i2c)
		return;
		return;
	WARN_ON(i2c->has_aux);
	i2c_del_adapter(&i2c->adapter);
	i2c_del_adapter(&i2c->adapter);
	kfree(i2c);
	kfree(i2c);
}
}