drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node()
Subsystems (3)
PATCH 1/1 drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node()
The reference 'child' in the iteration of for_each_available_child_of_node() is only escaped out into a local variable which is only used to check its value. So we still need to the of_node_put() when breaking of the for_each_available_child_of_node() which will automatically increase and decrease the refcount.
---
As 'Check-after-Put' has been widely accepted in kernel source, we just use it. If the maintainer thinks it is harmful, I'd like also to use 'Check-and-Put' coding style but with a bit more work.
drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/pl111/pl111_versatile.c +1 -0
@@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,if (of_device_is_compatible (child,"arm,pl111" )) { has_coretile_clcd = true; ct_clcd = child; +of_node_put (child);break ; }if (of_device_is_compatible (child,"arm,hdlcd" )) {
Signature · 1 line
2.25.1
Quoted 22 lines · Liang He
The reference 'child' in the iteration of
for_each_available_child_of_node()is only escaped out into a local variable which is only used to check its value. So we still need to theof_node_put()when breaking of thefor_each_available_child_of_node()which will automatically increase and decrease the refcount.Fixes ca454bd42dc2 ("drm/pl111: Support the Versatile Express")Signed-off-by Liang He <[email protected]>---
As 'Check-after-Put' has been widely accepted in kernel source, we just use it. If the maintainer thinks it is harmful, I'd like also to use 'Check-and-Put' coding style but with a bit more work.
drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/pl111/pl111_versatile.c +0
-0
drivers/gpu/drm/pl111/pl111_versatile.c static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, · line 405
Quoted 4 lines
drivers/gpu/drm/pl111/pl111_versatile.c +1
-0@@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,if (of_device_is_compatible (child,"arm,pl111" )) { has_coretile_clcd = true; ct_clcd = child; +of_node_put (child);
The same issue seems to exist right below in the next break? Can you pls respin with that included?
Thanks, Daniel
Quoted 6 lines
drivers/gpu/drm/pl111/pl111_versatile.c +0
-0break ; }if (of_device_is_compatible (child,"arm,hdlcd" )) {Signature · 1 line
2.25.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Rob Herring
Reviewed-byQuoted 19 lines · Daniel Vetter
Quoted 17 lines · Liang He
The reference 'child' in the iteration of
for_each_available_child_of_node()is only escaped out into a local variable which is only used to check its value. So we still need to theof_node_put()when breaking of thefor_each_available_child_of_node()which will automatically increase and decrease the refcount.Fixes ca454bd42dc2 ("drm/pl111: Support the Versatile Express")Signed-off-by Liang He <[email protected]>---
As 'Check-after-Put' has been widely accepted in kernel source, we just use it. If the maintainer thinks it is harmful, I'd like also to use 'Check-and-Put' coding style but with a bit more work.
drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
drivers/gpu/drm/pl111/pl111_versatile.c static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, · line 405
Quoted 9 lines
drivers/gpu/drm/pl111/pl111_versatile.c +1
-0@@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,if (of_device_is_compatible (child,"arm,pl111" )) { has_coretile_clcd = true; ct_clcd = child; +of_node_put (child);The same issue seems to exist right below in the next break? Can you pls respin with that included?
It has a put already.
Quoted 33 lines · Rob Herring
Quoted 19 lines · Daniel Vetter
Quoted 17 lines · Liang He
The reference 'child' in the iteration of
for_each_available_child_of_node()is only escaped out into a local variable which is only used to check its value. So we still need to theof_node_put()when breaking of thefor_each_available_child_of_node()which will automatically increase and decrease the refcount.Fixes ca454bd42dc2 ("drm/pl111: Support the Versatile Express")Signed-off-by Liang He <[email protected]>---
As 'Check-after-Put' has been widely accepted in kernel source, we just use it. If the maintainer thinks it is harmful, I'd like also to use 'Check-and-Put' coding style but with a bit more work.
drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
drivers/gpu/drm/pl111/pl111_versatile.c static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, · line 405
Quoted 9 lines
drivers/gpu/drm/pl111/pl111_versatile.c +1
-0@@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,if (of_device_is_compatible (child,"arm,pl111" )) { has_coretile_clcd = true; ct_clcd = child; +of_node_put (child);The same issue seems to exist right below in the next break? Can you pls respin with that included?
Quoted 3 lines
It has a put already.
Reviewed-by Rob Herring <[email protected]>
Huh I was blind.
Thanks for patch&review, pushed to drm-misc-next.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch