drm/amd/display/amdgpu_dm: Fix backlight_device_register() error handling
authorHans de Goede <hdegoede@redhat.com>
Sun, 12 Mar 2023 19:17:46 +0000 (20:17 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 22 Mar 2023 04:47:59 +0000 (00:47 -0400)
commit4db231d7dd80163fd251635f81280f1c93a393ab
tree5af93e66d19f1d91ddaab4c9933028468556db9b
parent5957a967599360477529ebd593e03f973dcb5fb2
drm/amd/display/amdgpu_dm: Fix backlight_device_register() error handling

backlight_device_register() returns an ERR_PTR on error, but other code
such as amdgpu_dm_connector_destroy() assumes dm->backlight_dev[i] is NULL
if no backlight is registered.

Clear dm->backlight_dev[i] on registration failure, to avoid other code
trying to deref an ERR_PTR pointer.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c