From mboxrd@z Thu Jan 1 00:00:00 1970 From: Archit Taneja Subject: Re: [PATCH v2 1/3] drm/msm/hdmi: Prevent gpio_free related kernel warnings Date: Wed, 27 Apr 2016 10:25:06 +0530 Message-ID: <5720462A.8010304@codeaurora.org> References: <1461063396-2285-1-git-send-email-architt@codeaurora.org> <1461579402-14301-1-git-send-email-architt@codeaurora.org> <1461579402-14301-2-git-send-email-architt@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-arm-msm-owner@vger.kernel.org To: twp@codeaurora.org Cc: dri-devel@lists.freedesktop.org, robdclark@gmail.com, daniel@ffwll.ch, linux-arm-msm@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org List-Id: dri-devel@lists.freedesktop.org On 04/25/2016 11:18 PM, twp@codeaurora.org wrote: > On 2016-04-25 03:16, Archit Taneja wrote: >> 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 >> --- >> drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 19 ++++++++++++------- >> 1 file changed, 12 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c >> b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c >> index 26129bf..ce86117 100644 >> --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c >> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c >> @@ -112,13 +112,16 @@ static int gpio_config(struct hdmi *hdmi, bool on) >> for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { >> struct hdmi_gpio_data gpio = config->gpios[i]; >> >> - if (gpio.output) { >> - int value = gpio.value ? 0 : 1; >> + if (gpio.num != -1) { >> + if (gpio.output) { >> + int value = gpio.value ? 0 : 1; >> >> - gpio_set_value_cansleep(gpio.num, value); >> - } >> + gpio_set_value_cansleep(gpio.num, >> + value); >> + } >> >> - gpio_free(gpio.num); >> + gpio_free(gpio.num); >> + } > > Can you do something like: > > if (gpio.num == -1) > continue; > > instead? That would avoid the additional indentation (and increase > readability). Yes, that should make things cleaner. I'll make this change. Thanks, Archit -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation