Skip to contentSkip to conversation

mmc: cavium-octeon: Add of_node_put() when breaking out of loop

PATCH In review Liang He 3 participants 6 messages Jul 19, 2022 – Jul 21, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/2 mmc: cavium-octeon: Add of_node_put() when breaking out of loop

In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 01d95843335c ("mmc: cavium: Add MMC support for Octeon SOCs.")
---
 drivers/mmc/host/cavium-octeon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/cavium-octeon.c +1 -0
index 2c4b2df52adb..12dca91a8ef6 100644
@@ -277,6 +277,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
 		if (ret) {
 			dev_err(&pdev->dev, "Error populating slots\n");
 			octeon_mmc_set_shared_power(host, 0);
+			of_node_put(cn);
 			goto error;
 		}
 		i++;
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 mmc: cavium-thunderx: Add of_node_put() when breaking out of loop

In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 166bac38c3c5 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs")
---
 drivers/mmc/host/cavium-thunderx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/cavium-thunderx.c +3 -1
index 76013bbbcff3..202b1d6da678 100644
@@ -142,8 +142,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
 				continue;
 
 			ret = cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host);
-			if (ret)
+			if (ret) {
+				of_node_put(child_node);
 				goto error;
+			}
 		}
 		i++;
 	}
Signature · 1 line
2.25.1
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] mmc: cavium-thunderx: Add of_node_put() when breaking out of loop

Quoted 6 lines · Liang He

In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 166bac38c3c5 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs")
Quoted 3 lines
---
 drivers/mmc/host/cavium-thunderx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw

Re: [PATCH 2/2] mmc: cavium-thunderx: Add of_node_put() when breaking out of loop

In reply to Liang He
Quoted 7 lines · Liang He

In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 166bac38c3c5 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs")

Applied for next, thanks!

Kind regards
Uffe

Quoted 23 lines
---
 drivers/mmc/host/cavium-thunderx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/cavium-thunderx.c +3 -2
index 76013bbbcff3..202b1d6da678 100644
@@ -142,8 +142,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
                                continue;
 
                        ret = cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host);
-                       if (ret)
+                       if (ret) {
+                               of_node_put(child_node);
                                goto error;
+                       }
                }
                i++;
        }
--

2.25.1

maintainer Acked-by on v1 1/2
#4 lore raw
In reply to Liang He
Quoted 6 lines · Liang He

In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 01d95843335c ("mmc: cavium: Add MMC support for Octeon SOCs.")
Quoted 3 lines
---
 drivers/mmc/host/cavium-octeon.c | 1 +
 1 file changed, 1 insertion(+)
#5 lore raw
In reply to Liang He
Quoted 7 lines · Liang He

In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration.

Fixes 01d95843335c ("mmc: cavium: Add MMC support for Octeon SOCs.")

Applied for next, thanks!

Kind regards

Ulf Hansson

Quoted 19 lines
---
 drivers/mmc/host/cavium-octeon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/cavium-octeon.c +1 -1
index 2c4b2df52adb..12dca91a8ef6 100644
@@ -277,6 +277,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
                if (ret) {
                        dev_err(&pdev->dev, "Error populating slots\n");
                        octeon_mmc_set_shared_power(host, 0);
+                       of_node_put(cn);
                        goto error;
                }
                i++;
--

2.25.1