xen/arm: Remove unused tnode variables in DT IRQ map parsing
PATCH 1/1 xen/arm: Remove unused tnode variables in DT IRQ map parsing
Remove unused tnode variables in device tree IRQ map parsing Coverity-ID 1381866, 1381867
--- xen/common/device_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
xen/common/device_tree.c +4 -8
@@ -1053,7 +1053,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, void *), void *data) { -const struct dt_device_node *ipar, *tnode, *old =NULL ; +const struct dt_device_node *ipar, *old =NULL ;const __be32 *tmp, *imap;u32 intsize =1 , addrsize, pintsize =0 , paddrsize =0 ;u32 imaplen;
@@ -1078,7 +1078,6 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )
@@ -1101,8 +1100,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL ); old =NULL ;
@@ -1238,7 +1236,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent,const __be32 *addr, struct dt_raw_irq *oirq) { - const struct dt_device_node *ipar, *tnode, *old = NULL, *newpar = NULL; + const struct dt_device_node *ipar, *old = NULL, *newpar = NULL;const __be32 *tmp, *imap, *imask;u32 intsize =1 , addrsize, newintsize =0 , newaddrsize =0 ;u32 imaplen;
@@ -1261,7 +1259,6 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )
@@ -1281,8 +1278,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL ); old =NULL ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Artem,
Quoted 1 line · Artem Mygaiev
Remove unused tnode variables in device tree IRQ map parsing
This description is slightly wrong, the variable are used but not the value.
Quoted 3 lines
Coverity-ID 1381866, 1381867
Signed-off-by Artem Mygaiev <[email protected]>
This code is from Linux (see drivers/of/irq.c) and I would prefer to keep it very similar as long as it does not lead to a bug:
Quoted 63 lines
--- xen/common/device_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)xen/common/device_tree.c +4
-8@@ -1053,7 +1053,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, void *), void *data) { -const struct dt_device_node *ipar, *tnode, *old =NULL ; +const struct dt_device_node *ipar, *old =NULL ;const __be32 *tmp, *imap;u32 intsize =1 , addrsize, pintsize =0 , paddrsize =0 ;u32 imaplen;@@ -1078,7 +1078,6 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )@@ -1101,8 +1100,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL ); old =NULL ;@@ -1238,7 +1236,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent,const __be32 *addr, struct dt_raw_irq *oirq) { - const struct dt_device_node *ipar, *tnode, *old = NULL, *newpar = NULL; + const struct dt_device_node *ipar, *old = NULL, *newpar = NULL;const __be32 *tmp, *imap, *imask;u32 intsize =1 , addrsize, newintsize =0 , newaddrsize =0 ;u32 imaplen;@@ -1261,7 +1259,6 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )@@ -1281,8 +1278,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL ); old =NULL ;
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Julien
Quoted 6 lines · Julien Grall
Hi Artem,
Quoted 1 line · Artem Mygaiev
Remove unused tnode variables in device tree IRQ map parsing
This description is slightly wrong, the variable are used but not the value.
True
Quoted 6 lines
Quoted 4 lines
Coverity-ID 1381866, 1381867
Signed-off-by Artem Mygaiev <[email protected]>This code is from Linux (see
drivers/of/irq.c) and I would prefer to keep it very similar as long as it does not lead to a bug:
I understand, but in the kernel code tnode is used to safely decrement kobj refcount (e.g. in 4.8.12):
144 tnode = of_get_parent(old); 145 of_node_put(old); 146 old = tnode;
AFAIU in Xen refcounts are dropped, so probably tnode can be dropped as a part of the infrastructure... no?
Quoted 63 lines
Nacked-by Julien Grall <[email protected]>Quoted 61 lines
--- xen/common/device_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)xen/common/device_tree.c +4
-8@@ -1053,7 +1053,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, void *), void *data) { -const struct dt_device_node *ipar, *tnode, *old =NULL ; +const struct dt_device_node *ipar, *old =NULL ;const __be32 *tmp, *imap;u32 intsize =1 , addrsize, pintsize =0 , paddrsize =0 ;u32 imaplen;@@ -1078,7 +1078,6 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )@@ -1101,8 +1100,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL ); old =NULL ;@@ -1238,7 +1236,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent,const __be32 *addr, struct dt_raw_irq *oirq) { - const struct dt_device_node *ipar, *tnode, *old = NULL, *newpar = NULL; + const struct dt_device_node *ipar, *old = NULL, *newpar = NULL;const __be32 *tmp, *imap, *imask;u32 intsize =1 , addrsize, newintsize =0 , newaddrsize =0 ;u32 imaplen;@@ -1261,7 +1259,6 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, intsize =be32_to_cpu (*tmp);break ; } - tnode = ipar; ipar =dt_irq_find_parent (ipar); }while ( ipar );if ( ipar ==NULL )@@ -1281,8 +1278,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, old = ipar;do { tmp =dt_get_property (old,"#address-cells" ,NULL ); - tnode =dt_get_parent (old); - old = tnode; + old =dt_get_parent (old); }while ( old && tmp ==NULL );
Quoted 3 lines
xen/common/device_tree.c static int dt_irq_map_raw(const struct dt_device_node *parent, · line 1284
Quoted 2 lines
xen/common/device_tree.c +0
-0old =NULL ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 16 lines · Artem Mygaiev
Hi Julien
Quoted 6 lines · Julien Grall
Hi Artem,
Quoted 1 line · Artem Mygaiev
Remove unused tnode variables in device tree IRQ map parsing
This description is slightly wrong, the variable are used but not the value.
True
Quoted 5 lines
Quoted 4 lines
Coverity-ID 1381866, 1381867
Signed-off-by Artem Mygaiev <[email protected]>
Quoted 8 lines
Quoted 1 line
This code is from Linux (see
drivers/of/irq.c) and I would prefer to keep it very similar as long as it does not lead to a bug:I understand, but in the kernel code tnode is used to safely decrement kobj refcount (e.g. in 4.8.12):
144 tnode = of_get_parent(old); 145 of_node_put(old); 146 old = tnode;AFAIU in Xen refcounts are dropped, so probably tnode can be dropped as a part of the infrastructure... no?
I have an item in my todo list to re-sync the device-tree code with Linux. So we have a proper copy rather than a modified one.
Meanwhile, I would strongly prefer to keep this code as close as possible from Linux. This tnode variable is harmless, so I stand on what I said.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 22 lines · Julien Grall
Quoted 19 lines · Artem Mygaiev
Hi Julien
Quoted 6 lines · Julien Grall
Hi Artem,
Quoted 1 line · Artem Mygaiev
Remove unused tnode variables in device tree IRQ map parsing
This description is slightly wrong, the variable are used but not the value.
True
Quoted 6 lines
Quoted 4 lines
Coverity-ID 1381866, 1381867
Signed-off-by Artem Mygaiev <[email protected]>This code is from Linux (see
drivers/of/irq.c) and I would prefer to keep it very similar as long as it does not lead to a bug:I understand, but in the kernel code tnode is used to safely decrement kobj refcount (e.g. in 4.8.12):
Quoted 7 lines
Quoted 5 lines
144 tnode = of_get_parent(old); 145 of_node_put(old); 146 old = tnode;AFAIU in Xen refcounts are dropped, so probably tnode can be dropped as a part of the infrastructure... no?
I have an item in my todo list to re-sync the device-tree code with Linux. So we have a proper copy rather than a modified one.
Oh, I see, thanks.
Quoted 5 lines
Meanwhile, I would strongly prefer to keep this code as close as possible from Linux. This tnode variable is harmless, so I stand on what I said.
Regards,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel