Commit 4db231d7 authored by Hans de Goede's avatar Hans de Goede Committed by Alex Deucher

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: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5957a967
...@@ -4218,9 +4218,10 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm) ...@@ -4218,9 +4218,10 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
&amdgpu_dm_backlight_ops, &amdgpu_dm_backlight_ops,
&props); &props);
if (IS_ERR(dm->backlight_dev[dm->num_of_edps])) if (IS_ERR(dm->backlight_dev[dm->num_of_edps])) {
DRM_ERROR("DM: Backlight registration failed!\n"); DRM_ERROR("DM: Backlight registration failed!\n");
else dm->backlight_dev[dm->num_of_edps] = NULL;
} else
DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name); DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment