drm/amd/display: invalid parameter check in dmub_hpd_callback
authorJosé Expósito <jose.exposito89@gmail.com>
Sun, 9 Jan 2022 18:42:45 +0000 (19:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:33 +0000 (17:25 +0200)
commitf85a6046f7718f11c6ad015a0ba25d897194b1ac
tree744c74731ec615933381879534d0d89b72cf214d
parent760fe32034931a8c97c773edef2f1b7c7346f43a
drm/amd/display: invalid parameter check in dmub_hpd_callback

commit 978ffac878fd64039f95798b15b430032d2d89d5 upstream.

The function performs a check on the "adev" input parameter, however, it
is used before the check.

Initialize the "dev" variable after the sanity check to avoid a possible
NULL pointer dereference.

Fixes: e27c41d5b0681 ("drm/amd/display: Support for DMUB HPD interrupt handling")
Addresses-Coverity-ID: 1493909 ("Null pointer dereference")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c