diff mbox

[v2,4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Message ID 1487251636-2480-4-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Superseded
Headers show

Commit Message

Charles Keepax Feb. 16, 2017, 1:27 p.m. UTC
Use devm_gpiochip_add_data to simplify the error path in
samsung_gpiolib_register. Additionally this would also fix a leak if
the pinctrl driver was unbound, although admittedly I can't see any
good use-case for doing so, but the driver does currently allow it.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Update commit message.

 drivers/pinctrl/samsung/pinctrl-samsung.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Krzysztof Kozlowski Feb. 17, 2017, 1:35 p.m. UTC | #1
On Thu, Feb 16, 2017 at 01:27:16PM +0000, Charles Keepax wrote:
> Use devm_gpiochip_add_data to simplify the error path in
> samsung_gpiolib_register. Additionally this would also fix a leak if
> the pinctrl driver was unbound, although admittedly I can't see any
> good use-case for doing so, but the driver does currently allow it.

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Regardless of this:
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Charles Keepax Feb. 17, 2017, 1:52 p.m. UTC | #2
On Fri, Feb 17, 2017 at 03:35:04PM +0200, Krzysztof Kozlowski wrote:
> On Thu, Feb 16, 2017 at 01:27:16PM +0000, Charles Keepax wrote:
> > Use devm_gpiochip_add_data to simplify the error path in
> > samsung_gpiolib_register. Additionally this would also fix a leak if
> > the pinctrl driver was unbound, although admittedly I can't see any
> > good use-case for doing so, but the driver does currently allow it.
> 
> Driver does not allow unbinding (.suppress_bind_attrs = true)...
> 

Oops... sorry missed that.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krzysztof Kozlowski March 20, 2017, 6:44 p.m. UTC | #3
On Fri, Feb 17, 2017 at 01:52:14PM +0000, Charles Keepax wrote:
> On Fri, Feb 17, 2017 at 03:35:04PM +0200, Krzysztof Kozlowski wrote:
> > On Thu, Feb 16, 2017 at 01:27:16PM +0000, Charles Keepax wrote:
> > > Use devm_gpiochip_add_data to simplify the error path in
> > > samsung_gpiolib_register. Additionally this would also fix a leak if
> > > the pinctrl driver was unbound, although admittedly I can't see any
> > > good use-case for doing so, but the driver does currently allow it.
> > 
> > Driver does not allow unbinding (.suppress_bind_attrs = true)...
> > 
> 
> Oops... sorry missed that.

Can you resend with updated commit msg? I think it was not picked up by
Linus yet.

Best regards,
Krzysztof

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij March 23, 2017, 9:47 a.m. UTC | #4
On Mon, Mar 20, 2017 at 7:44 PM, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Fri, Feb 17, 2017 at 01:52:14PM +0000, Charles Keepax wrote:
>> On Fri, Feb 17, 2017 at 03:35:04PM +0200, Krzysztof Kozlowski wrote:
>> > On Thu, Feb 16, 2017 at 01:27:16PM +0000, Charles Keepax wrote:
>> > > Use devm_gpiochip_add_data to simplify the error path in
>> > > samsung_gpiolib_register. Additionally this would also fix a leak if
>> > > the pinctrl driver was unbound, although admittedly I can't see any
>> > > good use-case for doing so, but the driver does currently allow it.
>> >
>> > Driver does not allow unbinding (.suppress_bind_attrs = true)...
>> >
>>
>> Oops... sorry missed that.
>
> Can you resend with updated commit msg? I think it was not picked up by
> Linus yet.

I'm expecting you to pick it up and send to me by pull request now I guess,
or did we agree that a Samsung patches wouldn't be too voluminous this
cycle?

If you're OK with it, can we proceed to use you as Samsung patch
collection point for this kernel cycle from this moment on?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krzysztof Kozlowski March 23, 2017, 11:34 a.m. UTC | #5
On Thu, Mar 23, 2017 at 11:47 AM, Linus Walleij
<linus.walleij@linaro.org> wrote:
> On Mon, Mar 20, 2017 at 7:44 PM, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > On Fri, Feb 17, 2017 at 01:52:14PM +0000, Charles Keepax wrote:
> >> On Fri, Feb 17, 2017 at 03:35:04PM +0200, Krzysztof Kozlowski wrote:
> >> > On Thu, Feb 16, 2017 at 01:27:16PM +0000, Charles Keepax wrote:
> >> > > Use devm_gpiochip_add_data to simplify the error path in
> >> > > samsung_gpiolib_register. Additionally this would also fix a leak if
> >> > > the pinctrl driver was unbound, although admittedly I can't see any
> >> > > good use-case for doing so, but the driver does currently allow it.
> >> >
> >> > Driver does not allow unbinding (.suppress_bind_attrs = true)...
> >> >
> >>
> >> Oops... sorry missed that.
> >
> > Can you resend with updated commit msg? I think it was not picked up by
> > Linus yet.
>
> I'm expecting you to pick it up and send to me by pull request now I guess,
> or did we agree that a Samsung patches wouldn't be too voluminous this
> cycle?
>
> If you're OK with it, can we proceed to use you as Samsung patch
> collection point for this kernel cycle from this moment on?

I will take it, especially that more things are coming. I already
applied patch from Chanwoo which should go to fixes (initially I put
it on wrong branch).

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 4ab20ec..eb08f30 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -934,20 +934,15 @@  static int samsung_gpiolib_register(struct platform_device *pdev,
 		gc->of_node = bank->of_node;
 		gc->label = bank->name;
 
-		ret = gpiochip_add_data(gc, bank);
+		ret = devm_gpiochip_add_data(&pdev->dev, gc, bank);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
 							gc->label, ret);
-			goto fail;
+			return ret;
 		}
 	}
 
 	return 0;
-
-fail:
-	for (--i, --bank; i >= 0; --i, --bank)
-		gpiochip_remove(&bank->gpio_chip);
-	return ret;
 }
 
 /* retrieve the soc specific data */