Skip to contentSkip to conversation

net: amd: add of_node_put()

PATCH Superseded Yangtao Li 2 participants 2 messages Nov 21, 2018 – Nov 22, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 net: amd: add of_node_put()

of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. bl_idle_init() doesn't do that, so fix it.

---
 drivers/net/ethernet/amd/sunlance.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/sunlance.c +3 -1
index b4fc0ed5bce8..9d4899826823 100644
@@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op,
 
 			prop = of_get_property(nd, "tpe-link-test?", NULL);
 			if (!prop)
-				goto no_link_test;
+				goto node_put;
 
 			if (strcmp(prop, "true")) {
 				printk(KERN_NOTICE "SunLance: warning: overriding option "
@@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op,
 				       "to [email protected]\n");
 				auxio_set_lte(AUXIO_LTE_ON);
 			}
+node_put:
+			of_node_put(nd);
 no_link_test:
 			lp->auto_select = 1;
 			lp->tpe = 0;
Signature · 1 line
2.17.0
#1 lore raw

Hello!

Quoted 3 lines · Yangtao Li

of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. bl_idle_init() doesn't do that, so fix it.

Again, maybe sparc_lance_probe_one() doesn't do that?

Quoted 19 lines
---
  drivers/net/ethernet/amd/sunlance.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/sunlance.c +1 -1
index b4fc0ed5bce8..9d4899826823 100644
@@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op,
 
  			prop = of_get_property(nd, "tpe-link-test?", NULL);
  			if (!prop)
-				goto no_link_test;
+				goto node_put;
 
  			if (strcmp(prop, "true")) {
  				printk(KERN_NOTICE "SunLance: warning: overriding option "

drivers/net/ethernet/amd/sunlance.c static int sparc_lance_probe_one(struct platform_device *op, · line 1435

Quoted 8 lines
drivers/net/ethernet/amd/sunlance.c +2 -0
@@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op,
  				       "to [email protected]\n");
  				auxio_set_lte(AUXIO_LTE_ON);
  			}
+node_put:
+			of_node_put(nd);
  no_link_test:
  			lp->auto_select = 1;
  			lp->tpe = 0;

MBR, Sergei