Skip to content

Commit d3455ab

Browse files
javiercarrascocruzclaudiubeznea
authored andcommitted
soc: atmel: fix device_node release in atmel_soc_device_init()
A device_node acquired via of_find_node_by_path() requires explicit calls to of_node_put() when it is no longer needed to avoid leaking the resource. Instead of adding the missing calls to of_node_put() in all execution paths, use the cleanup attribute for 'np' by means of the __free() macro, which automatically calls of_node_put() when the variable goes out of scope. Fixes: 960ddf7 ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://lore.kernel.org/r/20241031-soc-atmel-soc-cleanup-v2-1-73f2d235fd98@gmail.com Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
1 parent 40384c8 commit d3455ab

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/soc/atmel/soc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static const struct of_device_id at91_soc_allowed_list[] __initconst = {
399399

400400
static int __init atmel_soc_device_init(void)
401401
{
402-
struct device_node *np = of_find_node_by_path("/");
402+
struct device_node *np __free(device_node) = of_find_node_by_path("/");
403403

404404
if (!of_match_node(at91_soc_allowed_list, np))
405405
return 0;

0 commit comments

Comments
 (0)