lkml.org 
[lkml]   [2014]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] pinctrl: qcom: Release pin ranges when gpiochip_irqchip_add fails
From
On Wed, Aug 27, 2014 at 3:57 AM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:
> This patches adds a call to gpiochip_remove_pin_ranges when
> gpiochip_irqchip_add fails to release memory allocated for pin_ranges.
>
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -845,6 +845,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
> IRQ_TYPE_NONE);
> if (ret) {
> dev_err(pctrl->dev, "Failed to add irqchip to gpiochip\n");
> + gpiochip_remove_pin_ranges(chip);
> return -ENOSYS;
> }

Good catch, I guess this was lost in the introduction of gpiochip_irqchip...


Rather than just releasing the pin_ranges of the gpio_chip you should
probably add a gpiochip_remove() both here and in the case of
gpiochip_add_pin_range() failing.

Regards,
Bjorn


\
 
 \ /
  Last update: 2014-08-27 23:41    [W:2.748 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site