Skip to contentSkip to conversation

ata: pata_macio: add of_node_put()

PATCH Superseded Yangtao Li 4 participants 9 messages Nov 21, 2018 – Dec 21, 2018 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 ata: pata_macio: 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/ata/pata_macio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ata/pata_macio.c +2 -0
index 9588e685d994..8cc9c429ad95 100644
@@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
 		struct device_node *root = of_find_node_by_path("/");
 		const char *model = of_get_property(root, "model", NULL);
 
+		of_node_put(root);
+
 		if (cable && !strncmp(cable, "80-", 3)) {
 			/* Some drives fail to detect 80c cable in PowerBook
 			 * These machine use proprietary short IDE cable
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.

I thought we're inside pata_macio_cable_detect()?

Quoted 10 lines
---
 drivers/ata/pata_macio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ata/pata_macio.c +0 -0
index 9588e685d994..8cc9c429ad95 100644

drivers/ata/pata_macio.c static int pata_macio_cable_detect(struct ata_port *ap) · line 490

Quoted 8 lines
drivers/ata/pata_macio.c +2 -0
@@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
 		struct device_node *root = of_find_node_by_path("/");
 		const char *model = of_get_property(root, "model", NULL);
 
+		of_node_put(root);
+
 		if (cable && !strncmp(cable, "80-", 3)) {
 			/* Some drives fail to detect 80c cable in PowerBook
 			 * These machine use proprietary short IDE cable

MBR, Sergei

author
#2 lore raw
Quoted 10 lines · Sergei Shtylyov

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.

I thought we're inside pata_macio_cable_detect()?

Hi Sergei:

What do you mean?
Why not release the refcount of root?

Yours,
Yangtao

Quoted 21 lines
Quoted 11 lines
---
 drivers/ata/pata_macio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ata/pata_macio.c +0 -0
index 9588e685d994..8cc9c429ad95 100644

drivers/ata/pata_macio.c static int pata_macio_cable_detect(struct ata_port *ap) · line 490

Quoted 8 lines
drivers/ata/pata_macio.c +2 -0
@@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
              struct device_node *root = of_find_node_by_path("/");
              const char *model = of_get_property(root, "model", NULL);
 
+             of_node_put(root);
+
              if (cable && !strncmp(cable, "80-", 3)) {
                      /* Some drives fail to detect 80c cable in PowerBook
                       * These machine use proprietary short IDE cable

MBR, Sergei

author
#3 lore raw
Quoted 6 lines · Frank Lee
Quoted 3 lines · Sergei Shtylyov

Hello!

Quoted 7 lines
Quoted 7 lines · Yangtao Li
Quoted 4 lines

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.

I thought we're inside pata_macio_cable_detect()?

Hi Sergei:

Yeah,this is a typo.
Need me to resend a patch?

Thanks,
Yangtao

Quoted 28 lines

Hi Sergei:

What do you mean?
Why not release the refcount of root?

Yours,
Yangtao

Quoted 21 lines
Quoted 11 lines
---
 drivers/ata/pata_macio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ata/pata_macio.c +0 -0
index 9588e685d994..8cc9c429ad95 100644

drivers/ata/pata_macio.c static int pata_macio_cable_detect(struct ata_port *ap) · line 490

Quoted 8 lines
drivers/ata/pata_macio.c +2 -0
@@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
              struct device_node *root = of_find_node_by_path("/");
              const char *model = of_get_property(root, "model", NULL);
 
+             of_node_put(root);
+
              if (cable && !strncmp(cable, "80-", 3)) {
                      /* Some drives fail to detect 80c cable in PowerBook
                       * These machine use proprietary short IDE cable

MBR, Sergei

#4 lore raw
Quoted 9 lines · Frank Lee
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

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.

I thought we're inside pata_macio_cable_detect()?

Hi Sergei:

Yeah,this is a typo.
Need me to resend a patch?

This is more of a question for the libata maintainers (but I would resend).

Quoted 2 lines

Thanks,
Yangtao

MBR, Sergei

Acked-by on v1 1/1
#5 lore raw
In reply to Yangtao Li
Quoted 5 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.

Quoted 9 lines
 drivers/ata/pata_macio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ata/pata_macio.c +0 -0
index 9588e685d994..8cc9c429ad95 100644

drivers/ata/pata_macio.c static int pata_macio_cable_detect(struct ata_port *ap) · line 490

Quoted 8 lines
drivers/ata/pata_macio.c +2 -0
@@ -483,6 +483,8 @@ static int pata_macio_cable_detect(struct ata_port *ap)
 		struct device_node *root = of_find_node_by_path("/");
 		const char *model = of_get_property(root, "model", NULL);
 
+		of_node_put(root);
+
 		if (cable && !strncmp(cable, "80-", 3)) {
 			/* Some drives fail to detect 80c cable in PowerBook
 			 * These machine use proprietary short IDE cable

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

author
#7 lore raw
Quoted 8 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 4 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.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Yangtao, were you going to resend this one?

Actually,I've rensent the v2 at Nov 22.And I just changed the changelog. Can you pick it up?

Thanks,
Yangtao

#8 lore raw
Quoted 9 lines · Frank Lee
Quoted 8 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 4 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.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Yangtao, were you going to resend this one?

Actually,I've rensent the v2 at Nov 22.And I just changed the changelog. Can you pick it up?

I missed that, sorry. I'll pick it up.

Signature · 1 line
Jens Axboe