public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases
@ 2014-08-29  8:11 Pramod Gurav
  2014-08-29 18:57 ` Bjorn Andersson
  2014-09-02 12:28 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-08-29  8:11 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Ivan T. Ivanov

This patch releases gpiochip related resources by calling
gpiochip_remove when either of gpiochip_add_pin_range and
gpiochip_irqchip_add fails.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---

Changes since v1:
- In v1 of this patch gpiochip_remove was called only in failure case of
  gpiochip_irqchip_add. This patchs adds a call to gpiochip_remove in failure
  case of gpiochip_add_pin_range as well.

 drivers/pinctrl/qcom/pinctrl-msm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 2738108..9175bbc 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -829,6 +829,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
 	ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
 	if (ret) {
 		dev_err(pctrl->dev, "Failed to add pin range\n");
+		gpiochip_remove(&pctrl->chip);
 		return ret;
 	}
 
@@ -839,6 +840,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(&pctrl->chip);
 		return -ENOSYS;
 	}
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases
  2014-08-29  8:11 [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases Pramod Gurav
@ 2014-08-29 18:57 ` Bjorn Andersson
  2014-08-30  5:01   ` Pramod Gurav
  2014-08-30  5:06   ` Pramod Gurav
  2014-09-02 12:28 ` Linus Walleij
  1 sibling, 2 replies; 5+ messages in thread
From: Bjorn Andersson @ 2014-08-29 18:57 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Linus Walleij, Ivan T. Ivanov

On Fri 29 Aug 01:11 PDT 2014, Pramod Gurav wrote:

> This patch releases gpiochip related resources by calling
> gpiochip_remove when either of gpiochip_add_pin_range and
> gpiochip_irqchip_add fails.
> 
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

> ---
> 
> Changes since v1:
> - In v1 of this patch gpiochip_remove was called only in failure case of
>   gpiochip_irqchip_add. This patchs adds a call to gpiochip_remove in failure
>   case of gpiochip_add_pin_range as well.
> 
>  drivers/pinctrl/qcom/pinctrl-msm.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> index 2738108..9175bbc 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -829,6 +829,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>  	ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
>  	if (ret) {
>  		dev_err(pctrl->dev, "Failed to add pin range\n");
> +		gpiochip_remove(&pctrl->chip);
>  		return ret;
>  	}
>  
> @@ -839,6 +840,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(&pctrl->chip);
>  		return -ENOSYS;
>  	}
>  

It seems like pinctrl-st.c and pinctrl-sirf.c is suffering the same problem,
would you mind spinning patches for those too?

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases
  2014-08-29 18:57 ` Bjorn Andersson
@ 2014-08-30  5:01   ` Pramod Gurav
  2014-08-30  5:06   ` Pramod Gurav
  1 sibling, 0 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-08-30  5:01 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Linus Walleij, Ivan T. Ivanov

Hi Bjorn,


On 30-08-2014 12:27 AM, Bjorn Andersson wrote:
> On Fri 29 Aug 01:11 PDT 2014, Pramod Gurav wrote:
> 
>> This patch releases gpiochip related resources by calling
>> gpiochip_remove when either of gpiochip_add_pin_range and
>> gpiochip_irqchip_add fails.
>>
>> CC: Linus Walleij <linus.walleij@linaro.org>
>> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
>> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> 
> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> 
>> ---
>>
>> Changes since v1:
>> - In v1 of this patch gpiochip_remove was called only in failure case of
>>   gpiochip_irqchip_add. This patchs adds a call to gpiochip_remove in failure
>>   case of gpiochip_add_pin_range as well.
>>
>>  drivers/pinctrl/qcom/pinctrl-msm.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
>> index 2738108..9175bbc 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
>> @@ -829,6 +829,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>>  	ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
>>  	if (ret) {
>>  		dev_err(pctrl->dev, "Failed to add pin range\n");
>> +		gpiochip_remove(&pctrl->chip);
>>  		return ret;
>>  	}
>>  
>> @@ -839,6 +840,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(&pctrl->chip);
>>  		return -ENOSYS;
>>  	}
>>  
> 
> It seems like pinctrl-st.c and pinctrl-sirf.c is suffering the same problem,
> would you mind spinning patches for those too?
Sure. Was browsing files but I was caught by this thing called sleep
before I catch anything. :) Thanks for pointing them out. Will do it.

> 
> 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/
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases
  2014-08-29 18:57 ` Bjorn Andersson
  2014-08-30  5:01   ` Pramod Gurav
@ 2014-08-30  5:06   ` Pramod Gurav
  1 sibling, 0 replies; 5+ messages in thread
From: Pramod Gurav @ 2014-08-30  5:06 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Linus Walleij, Ivan T. Ivanov

Hi Bjorn,

On 30-08-2014 12:27 AM, Bjorn Andersson wrote:
> On Fri 29 Aug 01:11 PDT 2014, Pramod Gurav wrote:
> 
>> This patch releases gpiochip related resources by calling
>> gpiochip_remove when either of gpiochip_add_pin_range and
>> gpiochip_irqchip_add fails.
>>
>> CC: Linus Walleij <linus.walleij@linaro.org>
>> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
>> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> 
> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> 

<..>

> 
> It seems like pinctrl-st.c and pinctrl-sirf.c is suffering the same problem,
> would you mind spinning patches for those too?
Sure. Was browsing files but I was caught by this thing called sleep
before I catch anything. :) Thanks for pointing them out. Will do it.

> 
> 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/
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases
  2014-08-29  8:11 [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases Pramod Gurav
  2014-08-29 18:57 ` Bjorn Andersson
@ 2014-09-02 12:28 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-09-02 12:28 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Bjorn Andersson, Ivan T. Ivanov

On Fri, Aug 29, 2014 at 10:11 AM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:

> This patch releases gpiochip related resources by calling
> gpiochip_remove when either of gpiochip_add_pin_range and
> gpiochip_irqchip_add fails.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>
> Changes since v1:
> - In v1 of this patch gpiochip_remove was called only in failure case of
>   gpiochip_irqchip_add. This patchs adds a call to gpiochip_remove in failure
>   case of gpiochip_add_pin_range as well.

Patch applied with Björn's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-02 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-29  8:11 [PATCH v2] pinctrl: qcom: remove gpiochip in failure cases Pramod Gurav
2014-08-29 18:57 ` Bjorn Andersson
2014-08-30  5:01   ` Pramod Gurav
2014-08-30  5:06   ` Pramod Gurav
2014-09-02 12:28 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox