mirror of
https://github.com/torvalds/linux.git
synced 2026-04-27 11:02:31 -04:00
drm/amd/display: remove oem i2c adapter on finish
Fixes a bug where unbinding of the GPU would leave the oem i2c adapter
registered resulting in a null pointer dereference when applications try
to access the invalid device.
Fixes: 3d5470c973 ("drm/amd/display/dm: add support for OEM i2c bus")
Cc: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Geoffrey McRae <geoffrey.mcrae@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
276e8beb2a
commit
89923fb7ea
@@ -2957,6 +2957,17 @@ static int dm_oem_i2c_hw_init(struct amdgpu_device *adev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dm_oem_i2c_hw_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
|
||||
if (dm->oem_i2c) {
|
||||
i2c_del_adapter(&dm->oem_i2c->base);
|
||||
kfree(dm->oem_i2c);
|
||||
dm->oem_i2c = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dm_hw_init() - Initialize DC device
|
||||
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
|
||||
@@ -3007,7 +3018,7 @@ static int dm_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
{
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
|
||||
kfree(adev->dm.oem_i2c);
|
||||
dm_oem_i2c_hw_fini(adev);
|
||||
|
||||
amdgpu_dm_hpd_fini(adev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user