Skip to content

Commit 0461221

Browse files
Harry Wentlandalexdeucher
authored andcommitted
drm/amd/display: Check hpd_gpio for NULL before accessing it
dal_gpio_open and dal_gpio_unlock_pin dereference hpd_gpio. Check for NULL before calling those functions. Fixes: ac627ca ("drm/amd/display: add gpio lock/unlock") Reported-by: Przemek Socha <soprwa@gmail.com> CC: Chiawen Huang <chiawen.huang@amd.com> CC: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Tested-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 7fbd31c commit 0461221

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,10 +1127,11 @@ static bool construct(
11271127
link->dc->res_pool->funcs->link_init(link);
11281128

11291129
link->hpd_gpio = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);
1130-
dal_gpio_open(link->hpd_gpio, GPIO_MODE_INTERRUPT);
1131-
dal_gpio_unlock_pin(link->hpd_gpio);
1132-
if (link->hpd_gpio != NULL)
1130+
if (link->hpd_gpio != NULL) {
1131+
dal_gpio_open(link->hpd_gpio, GPIO_MODE_INTERRUPT);
1132+
dal_gpio_unlock_pin(link->hpd_gpio);
11331133
link->irq_source_hpd = dal_irq_get_source(link->hpd_gpio);
1134+
}
11341135

11351136
switch (link->link_id.id) {
11361137
case CONNECTOR_ID_HDMI_TYPE_A:

0 commit comments

Comments
 (0)