Commit c899f935 authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark

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: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 4816b626
...@@ -112,6 +112,9 @@ static int gpio_config(struct hdmi *hdmi, bool on) ...@@ -112,6 +112,9 @@ static int gpio_config(struct hdmi *hdmi, bool on)
for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
struct hdmi_gpio_data gpio = config->gpios[i]; struct hdmi_gpio_data gpio = config->gpios[i];
if (gpio.num == -1)
continue;
if (gpio.output) { if (gpio.output) {
int value = gpio.value ? 0 : 1; int value = gpio.value ? 0 : 1;
...@@ -126,8 +129,10 @@ static int gpio_config(struct hdmi *hdmi, bool on) ...@@ -126,8 +129,10 @@ static int gpio_config(struct hdmi *hdmi, bool on)
return 0; return 0;
err: err:
while (i--) while (i--) {
gpio_free(config->gpios[i].num); if (config->gpios[i].num != -1)
gpio_free(config->gpios[i].num);
}
return ret; return ret;
} }
......
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