Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/hdmi: Prevent gpio_free related kernel warnings

Calling the legacy gpio_free on an invalid GPIO (a GPIO numbered -1)
results in kernel warnings. This causes a lot of backtraces when
we try to unload the drm/msm module.

Call gpio_free only on valid GPIOs.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>

authored by

Archit Taneja and committed by
Rob Clark
c899f935 4816b626

+7 -2
+7 -2
drivers/gpu/drm/msm/hdmi/hdmi_connector.c
··· 112 112 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { 113 113 struct hdmi_gpio_data gpio = config->gpios[i]; 114 114 115 + if (gpio.num == -1) 116 + continue; 117 + 115 118 if (gpio.output) { 116 119 int value = gpio.value ? 0 : 1; 117 120 ··· 129 126 130 127 return 0; 131 128 err: 132 - while (i--) 133 - gpio_free(config->gpios[i].num); 129 + while (i--) { 130 + if (config->gpios[i].num != -1) 131 + gpio_free(config->gpios[i].num); 132 + } 134 133 135 134 return ret; 136 135 }