[PATCH] docs: driver-api pinctrl cleanup

Alex Tran posted 1 patch 1 month, 1 week ago
There is a newer version of this series
Documentation/driver-api/pin-control.rst | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
[PATCH] docs: driver-api pinctrl cleanup
Posted by Alex Tran 1 month, 1 week ago
Resource cleanup when using pinctrl.

Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
---
 Documentation/driver-api/pin-control.rst | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/driver-api/pin-control.rst b/Documentation/driver-api/pin-control.rst
index 27ea12363..281533c33 100644
--- a/Documentation/driver-api/pin-control.rst
+++ b/Documentation/driver-api/pin-control.rst
@@ -1202,22 +1202,24 @@ default state like this:
 	{
 		/* Allocate a state holder named "foo" etc */
 		struct foo_state *foo = ...;
+		int ret;
 
 		foo->p = devm_pinctrl_get(&device);
 		if (IS_ERR(foo->p)) {
-			/* FIXME: clean up "foo" here */
-			return PTR_ERR(foo->p);
+			ret = PTR_ERR(foo->p);
+			foo->p = NULL;
+			return ret;
 		}
 
 		foo->s = pinctrl_lookup_state(foo->p, PINCTRL_STATE_DEFAULT);
 		if (IS_ERR(foo->s)) {
-			/* FIXME: clean up "foo" here */
+			devm_pinctrl_put(foo->p);
 			return PTR_ERR(foo->s);
 		}
 
 		ret = pinctrl_select_state(foo->p, foo->s);
 		if (ret < 0) {
-			/* FIXME: clean up "foo" here */
+			devm_pinctrl_put(foo->p);
 			return ret;
 		}
 	}
-- 
2.51.0
Re: [PATCH] docs: driver-api pinctrl cleanup
Posted by Jonathan Corbet 1 month, 1 week ago
Alex Tran <alex.t.tran@gmail.com> writes:

> Resource cleanup when using pinctrl.
>
> Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
> ---
>  Documentation/driver-api/pin-control.rst | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

I hate to complain but ... this patch really needs a changelog saying
what you are changing and why.

Thanks,

jon
Re: [PATCH] docs: driver-api pinctrl cleanup
Posted by Alex Tran 1 month, 1 week ago
On Wed, Aug 27, 2025 at 12:03 AM Jonathan Corbet <corbet@lwn.net> wrote:
>
> Alex Tran <alex.t.tran@gmail.com> writes:
>
> > Resource cleanup when using pinctrl.
> >
> > Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
> > ---
> >  Documentation/driver-api/pin-control.rst | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
>
> I hate to complain but ... this patch really needs a changelog saying
> what you are changing and why.
>
> Thanks,
>
> jon

Sorry about that. I'll send in a patch v2 with a better description
and a changelog.

-- 
Alex Tran
alex.t.tran@gmail.com | 408-406-2417