net: dsa: add missing of_node_put
Subsystems (3)
PATCH 1/1 net: dsa: add missing of_node_put
Decrement the reference count on port while returning out of the loop. Issue identified by Coccinelle.
Signed-off-by Himadri Pandya <[email protected]>
--- net/dsa/dsa2.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/dsa/dsa2.c +10 -4
@@ -624,19 +624,25 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,for_each_available_child_of_node (ports, port) { err =of_property_read_u32 (port,"reg" , ®);if (err) -return err; + goto put_port; -if (reg >= ds->num_ports) -return -EINVAL ; +if (reg >= ds->num_ports) { + err = -EINVAL ; + goto put_port; + } dp = &ds->ports[reg]; err =dsa_port_parse_of (dp, port);if (err) -return err; + goto put_port; }return 0 ; + +put_port: +of_node_put (port); +return err; } static int dsa_switch_parse_member_of(struct dsa_switch *ds,
Signature · 1 line
2.17.1
Andrew Lunn
maintainerQuoted 2 lines · Himadri Pandya
Decrement the reference count on port while returning out of the loop. Issue identified by Coccinelle.
You and Wen Yang are both fixing the same issue. Maybe you can coordinate?
Andrew
Quoted 5 lines · Andrew Lunn
Quoted 2 lines · Himadri Pandya
Decrement the reference count on port while returning out of the loop. Issue identified by Coccinelle.
You and Wen Yang are both fixing the same issue. Maybe you can coordinate?
Sure.
- Himadri
Quoted 2 lines
Andrew