Commit 87abff77 authored by Colin Ian King's avatar Colin Ian King Committed by Alex Deucher

drm/amd/display: fix a missing null check on a failed kzalloc

Currently the allocation of config may fail and a null pointer
dereference on config can occur.  Fix this by added a null
check on a failed allocation of config.

Addresses-Coverity: ("Dereference null return")
Fixes: c2cd9d04 ("drm/amd/display: Hook up calls to do stereo mux and dig programming to stereo control interface")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 59d788b1
...@@ -1259,6 +1259,8 @@ bool dc_set_generic_gpio_for_stereo(bool enable, ...@@ -1259,6 +1259,8 @@ bool dc_set_generic_gpio_for_stereo(bool enable,
struct gpio_generic_mux_config *config = kzalloc(sizeof(struct gpio_generic_mux_config), struct gpio_generic_mux_config *config = kzalloc(sizeof(struct gpio_generic_mux_config),
GFP_KERNEL); GFP_KERNEL);
if (!config)
return false;
pin_info = dal_gpio_get_generic_pin_info(gpio_service, GPIO_ID_GENERIC, 0); pin_info = dal_gpio_get_generic_pin_info(gpio_service, GPIO_ID_GENERIC, 0);
if (pin_info.mask == 0xFFFFFFFF || pin_info.offset == 0xFFFFFFFF) { if (pin_info.mask == 0xFFFFFFFF || pin_info.offset == 0xFFFFFFFF) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment