aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2016-05-02 01:35:52 -0400
committerRob Clark <robdclark@gmail.com>2016-05-08 10:22:19 -0400
commitc899f9358485869a6e18902233eb77b31f0428ee (patch)
treebf405559b3f64ff045ffdc689282f2eb927d98b4 /drivers/gpu/drm/msm
parent4816b6267cf078f40158ff2e6bf9d0223f0c1cf6 (diff)
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>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi_connector.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
index 26129bff2dd6..e350b2e1fce1 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
@@ -112,6 +112,9 @@ static int gpio_config(struct hdmi *hdmi, bool on)
112 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { 112 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
113 struct hdmi_gpio_data gpio = config->gpios[i]; 113 struct hdmi_gpio_data gpio = config->gpios[i];
114 114
115 if (gpio.num == -1)
116 continue;
117
115 if (gpio.output) { 118 if (gpio.output) {
116 int value = gpio.value ? 0 : 1; 119 int value = gpio.value ? 0 : 1;
117 120
@@ -126,8 +129,10 @@ static int gpio_config(struct hdmi *hdmi, bool on)
126 129
127 return 0; 130 return 0;
128err: 131err:
129 while (i--) 132 while (i--) {
130 gpio_free(config->gpios[i].num); 133 if (config->gpios[i].num != -1)
134 gpio_free(config->gpios[i].num);
135 }
131 136
132 return ret; 137 return ret;
133} 138}