drm/amd/display: Check engine is not NULL before acquiring
authorAric Cyr <aric.cyr@amd.com>
Wed, 22 Jan 2020 03:50:13 +0000 (22:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:38 +0000 (16:43 +0100)
[ Upstream commit 2b63d0ec0daf79ba503fa8bfa25e07dc3da274f3 ]

[Why]
Engine can be NULL in some cases, so we must not acquire it.

[How]
Check for NULL engine before acquiring.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c

index c3f9f4185ce8dafdcf157c372d0364ddcf126361..cf877238fff9d421fbb9957eb3936909b9626094 100644 (file)
@@ -386,7 +386,7 @@ static bool acquire(
 {
        enum gpio_result result;
 
-       if (!is_engine_available(engine))
+       if ((engine == NULL) || !is_engine_available(engine))
                return false;
 
        result = dal_ddc_open(ddc, GPIO_MODE_HARDWARE,