public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pramod Gurav <pramod.gurav@smartplayin.com>
To: Bjorn Andersson <bjorn@kryo.se>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	"Ivan T. Ivanov" <iivanov@mm-sol.com>,
	Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] pinctrl: qcom: Release pin ranges when gpiochip_irqchip_add fails
Date: Thu, 28 Aug 2014 12:43:31 +0530	[thread overview]
Message-ID: <53FED69B.3020406@smartplayin.com> (raw)
In-Reply-To: <CAJAp7OhnUD3oSLfcRMD3veSJhVQLZdW1FPb8grOYqN5Gh3Oagw@mail.gmail.com>

On Thursday 28 August 2014 02:54 AM, Bjorn Andersson wrote:
> 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.

Thanks for review. But if I see implementation of gpiochip_remove() it does:
	gpiochip_irqchip_remove(chip);
        gpiochip_remove_pin_ranges(chip);
        of_gpiochip_remove(chip);

In above failure case only gpiochip_add() and gpiochip_add_pin_range()
have been successful hence I thought that would cause any problem to add
gpiochip_remove(). If that is not a problem I think we can call
gpiochip_remove() in fail case of gpiochip_add_pin_range() as well.
Do I make sense?

> 
> Regards,
> Bjorn
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

  reply	other threads:[~2014-08-28  7:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 10:57 [PATCH] pinctrl: qcom: Release pin ranges when gpiochip_irqchip_add fails Pramod Gurav
2014-08-27 21:24 ` Bjorn Andersson
2014-08-28  7:13   ` Pramod Gurav [this message]
2014-08-29  3:49     ` Bjorn Andersson
2014-08-29  7:19       ` Pramod Gurav
2014-09-02 12:29 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53FED69B.3020406@smartplayin.com \
    --to=pramod.gurav@smartplayin.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=bjorn@kryo.se \
    --cc=iivanov@mm-sol.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox