backlight: sky81452-backlight: replace of_node_put with __free
Subsystems (2)
PATCH 1/1 backlight: sky81452-backlight: replace of_node_put with __free
Use the new cleanup magic to replace of_node_put() with __free(device_node) marking to auto release when they get out of scope.
--- drivers/video/backlight/sky81452-backlight.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/video/backlight/sky81452-backlight.c +2 -6
@@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = {static struct sky81452_bl_platform_data *sky81452_bl_parse_dt (struct device *dev) { -struct device_node *np =of_node_get (dev->of_node); + struct device_node *np __free(device_node) = of_node_get(dev->of_node);struct sky81452_bl_platform_data *pdata;int num_entry;unsigned int sources[6 ];
@@ -194,10 +194,8 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( } pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); -if (!pdata) { -of_node_put (np); +if (!pdata)return ERR_PTR (-ENOMEM ); - }of_property_read_string (np,"name" , &pdata->name); pdata->ignore_pwm =of_property_read_bool (np,"skyworks,ignore-pwm" );
@@ -217,7 +215,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( num_entry);if (ret <0 ) {dev_err (dev,"led-sources node is invalid.\n" ); -of_node_put (np);return ERR_PTR (-EINVAL ); }
@@ -237,7 +234,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(if (ret <0 ) pdata->boost_current_limit =2750 ; -of_node_put (np); return pdata; }#else
Signature · 1 line
2.34.1
Quoted 5 lines · R Sundar
Use the new cleanup magic to replace
of_node_put()with__free(device_node)marking to auto release when they get out of scope.Suggested-by Julia Lawall <[email protected]>Signed-off-by R Sundar <[email protected]>
Thanks for the patch but I think this one is a more appropriate solution to this issue:
https://lore.kernel.org/all/[email protected]/
Daniel.
Quoted 10 lines · Daniel Thompson
Quoted 5 lines · R Sundar
Use the new cleanup magic to replace
of_node_put()with__free(device_node)marking to auto release when they get out of scope.Suggested-by Julia Lawall <[email protected]>Signed-off-by R Sundar <[email protected]>Thanks for the patch but I think this one is a more appropriate solution to this issue:
https://lore.kernel.org/all/[email protected]/
Maybe neither one is perfect? The one I see at that link has:
if (!pdata) {
- of_node_put(np);
return ERR_PTR(-ENOMEM);
}
which has unneeded {}
julia
Quoted 4 lines
Daniel.
I'll remove the unnecessary braces and resend the patch.
Regards,
Shresth
Quoted 32 lines · Julia Lawall
Quoted 10 lines · Daniel Thompson
Quoted 5 lines · R Sundar
Use the new cleanup magic to replace
of_node_put()with__free(device_node)marking to auto release when they get out of scope.Suggested-by Julia Lawall <[email protected]>Signed-off-by R Sundar <[email protected]>Thanks for the patch but I think this one is a more appropriate solution to this issue:
https://lore.kernel.org/all/[email protected]/Maybe neither one is perfect? The one I see at that link has:
if (!pdata) { - of_node_put(np); return ERR_PTR(-ENOMEM); }which has unneeded {}
julia
Quoted 4 lines
Daniel.