Re: usb: typec: anx7411: Use scope-based resource management in anx7411_typec_port_probe()

From: Markus Elfring
Date: Thu Jun 06 2024 - 04:41:16 EST


>> Scope-based resource management became supported also for another
>> programming interface by contributions of Jonathan Cameron on 2024-02-17.
>> See also the commit 59ed5e2d505bf5f9b4af64d0021cd0c96aec1f7c ("device
>> property: Add cleanup.h based fwnode_handle_put() scope based cleanup.").
>>
>> * Thus use the attribute “__free(fwnode_handle)”.
>>
>> * Reduce the scope for the local variable “fwnode”.
>>
>> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
>> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
>
> Was the fwnode leaked, or why else is this a "fix"? It's not clear
> from the commit message.
Can you notice that fwnode_handle_put() calls were forgotten
in the mentioned function implementation?
https://elixir.bootlin.com/linux/v6.10-rc2/source/drivers/usb/typec/anx7411.c#L1140

I propose another code cleanup accordingly.


Will development attention grow anyhow for information in the available
API documentation?

Example:
device_get_named_child_node()
https://elixir.bootlin.com/linux/v6.10-rc2/source/drivers/base/property.c#L839

Regards,
Markus