[PATCH 22/23] drm/amd/display: Add null check to dc_submit_i2c_oem
Hamza Mahfooz
hamza.mahfooz at amd.com
Fri Jun 10 20:52:44 UTC 2022
From: Martin Leung <martin.leung at amd.com>
[why]
dc_submit_i2c_oem could be called with ddc null
[how]
add null check and fail the call instead
Acked-by: Alan Liu <HaoPing.Liu at amd.com>
Signed-off-by: Martin Leung <martin.leung at amd.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 49339c5c7230..258322c39e9a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -3477,10 +3477,13 @@ bool dc_submit_i2c_oem(
struct i2c_command *cmd)
{
struct ddc_service *ddc = dc->res_pool->oem_device;
- return dce_i2c_submit_command(
- dc->res_pool,
- ddc->ddc_pin,
- cmd);
+ if (ddc)
+ return dce_i2c_submit_command(
+ dc->res_pool,
+ ddc->ddc_pin,
+ cmd);
+
+ return false;
}
static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink *sink)
--
2.36.1
More information about the amd-gfx
mailing list