gpu:ipu-v3:pre: replace of_node_put() with __free
Subsystems (2)
PATCH 1/1 gpu:ipu-v3:pre: 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.
Suggested-by Julia Lawall <[email protected]>
Signed-off-by R Sundar <[email protected]>
--- drivers/gpu/ipu-v3/ipu-pre.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/ipu-v3/ipu-pre.c +2 -5
@@ -113,8 +113,8 @@ int ipu_pre_get_available_count(void)struct ipu_pre *ipu_pre_lookup_by_phandle (struct device *dev,const char *name,int index) { -struct device_node *pre_node =of_parse_phandle (dev->of_node, - name, index); + struct device_node *pre_node __free(device_node) = +of_parse_phandle (dev->of_node, name, index);struct ipu_pre *pre;mutex_lock (&ipu_pre_list_mutex);
@@ -123,14 +123,11 @@ ipu_pre_lookup_by_phandle(struct device *dev, const char *name, int index)mutex_unlock (&ipu_pre_list_mutex);device_link_add (dev, pre->dev,DL_FLAG_AUTOREMOVE_CONSUMER ); -of_node_put (pre_node);return pre; } }mutex_unlock (&ipu_pre_list_mutex); -of_node_put (pre_node); -return NULL ; }
Signature · 1 line
2.34.1
Quoted 29 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]>--- drivers/gpu/ipu-v3/ipu-pre.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/gpu/ipu-v3/ipu-pre.c +2
-3@@ -113,8 +113,8 @@ int ipu_pre_get_available_count(void)struct ipu_pre *ipu_pre_lookup_by_phandle (struct device *dev,const char *name,int index) { -struct device_node *pre_node =of_parse_phandle (dev->of_node, - name, index); + struct device_node *pre_node __free(device_node) = +of_parse_phandle (dev->of_node, name, index);struct ipu_pre *pre;mutex_lock (&ipu_pre_list_mutex);@@ -123,14 +123,11 @@ ipu_pre_lookup_by_phandle(struct device *dev, const char *name, int index)mutex_unlock (&ipu_pre_list_mutex);device_link_add (dev, pre->dev,DL_FLAG_AUTOREMOVE_CONSUMER ); -of_node_put (pre_node);
drivers/gpu/ipu-v3/ipu-pre.c ipu_pre_lookup_by_phandle(struct device *dev, const char *name, int index) · line 133
Quoted 10 lines
drivers/gpu/ipu-v3/ipu-pre.c +0
-2return pre; } }mutex_unlock (&ipu_pre_list_mutex); -of_node_put (pre_node); -return NULL ; }
Hi,
Any feedback on this patch.
Thanks,
Sundar
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]>
Reviewed-by Philipp Zabel <[email protected]>
regards
Philipp