Re: [PATCH] usb: typec: mux: replace of_node_put() with __free [linux-next]

From: sundar.R
Date: Thu Apr 11 2024 - 23:48:15 EST


Hi greg k-h,

Thanks for comments provided.

On 11/04/24 17:47, Greg KH wrote:
On Wed, Apr 10, 2024 at 10:22:22PM +0530, R SUNDAR wrote:
use the new cleanup magic to replace of_node_put() with
__free(device_node) marking to auto release and to simplify the error
paths.

Suggested-by: Julia Lawall <julia.lawall@xxxxxxxx>
Signed-off-by: R SUNDAR <prosunofficial@xxxxxxxxx>

All CAPS for your name? Is that how it is written on documents (for
some countries this is normal, but usually not, so I have to ask.)

In documents it was like that.I also thought to change to small letters in git user name.
will change to small letter.

-
- ep = of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0);
+ struct device_node *ep __free(device_node) =

And if so, why this random USB driver being the first one? Have you
tested this?

I haven't tested it.I picked this usb driver to get cleanup module changes with __free.
I believe since of_node_put() is scope based here,we can use cleanup to remove the goto label uses in case of error.
>
+ of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0);
if (ep) {

the "common" path should not be indented, but only the exception (i.e. bail
if ep is not allocated properly.)
I Tried in same line initialization, it exceeds column limit.
so indented in next line.



thanks,

greg k-h

Regards,
Sundar