Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04612213 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher
Browse files

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: ac627caf ("drm/amd/display: add gpio lock/unlock")
Reported-by: default avatarPrzemek Socha <soprwa@gmail.com>
CC: Chiawen Huang <chiawen.huang@amd.com>
CC: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Tested-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7fbd31cc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1127,10 +1127,11 @@ static bool construct(
		link->dc->res_pool->funcs->link_init(link);

	link->hpd_gpio = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);
	if (link->hpd_gpio != NULL) {
		dal_gpio_open(link->hpd_gpio, GPIO_MODE_INTERRUPT);
		dal_gpio_unlock_pin(link->hpd_gpio);
	if (link->hpd_gpio != NULL)
		link->irq_source_hpd = dal_irq_get_source(link->hpd_gpio);
	}

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