* [PATCH -next 01/12] mfd: max77620: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 02/12] mfd: qcom-spmi-pmic: " Jinjie Ruan
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mfd/max77620.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index 74ef3f6d576c..89b30ef91f4f 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -400,7 +400,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
static int max77620_initialise_fps(struct max77620_chip *chip)
{
struct device *dev = chip->dev;
- struct device_node *fps_np, *fps_child;
+ struct device_node *fps_np;
u8 config;
int fps_id;
int ret;
@@ -414,10 +414,9 @@ static int max77620_initialise_fps(struct max77620_chip *chip)
if (!fps_np)
goto skip_fps;
- for_each_child_of_node(fps_np, fps_child) {
+ for_each_child_of_node_scoped(fps_np, fps_child) {
ret = max77620_config_fps(chip, fps_child);
if (ret < 0) {
- of_node_put(fps_child);
of_node_put(fps_np);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 02/12] mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 01/12] mfd: max77620: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 03/12] mtd: rawnand: arasan: " Jinjie Ruan
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mfd/qcom-spmi-pmic.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index eab5bf6cff10..b4b178caf754 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -84,7 +84,6 @@ static const struct of_device_id pmic_spmi_id_table[] = {
static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, struct qcom_spmi_dev *ctx)
{
struct device_node *spmi_bus;
- struct device_node *child;
int function_parent_usid, ret;
u32 pmic_addr;
@@ -108,10 +107,9 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
*/
spmi_bus = of_get_parent(sdev->dev.of_node);
sdev = ERR_PTR(-ENODATA);
- for_each_child_of_node(spmi_bus, child) {
+ for_each_child_of_node_scoped(spmi_bus, child) {
ret = of_property_read_u32_index(child, "reg", 0, &pmic_addr);
if (ret) {
- of_node_put(child);
sdev = ERR_PTR(ret);
break;
}
@@ -125,7 +123,6 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
*/
sdev = ERR_PTR(-EPROBE_DEFER);
}
- of_node_put(child);
break;
}
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 03/12] mtd: rawnand: arasan: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 01/12] mfd: max77620: " Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 02/12] mfd: qcom-spmi-pmic: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 04/12] mtd: rawnand: cadence: " Jinjie Ruan
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/arasan-nand-controller.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/arasan-nand-controller.c b/drivers/mtd/nand/raw/arasan-nand-controller.c
index 2ff1d2b13e3c..5436ec4a8fde 100644
--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -1360,7 +1360,7 @@ static void anfc_chips_cleanup(struct arasan_nfc *nfc)
static int anfc_chips_init(struct arasan_nfc *nfc)
{
- struct device_node *np = nfc->dev->of_node, *nand_np;
+ struct device_node *np = nfc->dev->of_node;
int nchips = of_get_child_count(np);
int ret;
@@ -1370,10 +1370,9 @@ static int anfc_chips_init(struct arasan_nfc *nfc)
return -EINVAL;
}
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = anfc_chip_init(nfc, nand_np);
if (ret) {
- of_node_put(nand_np);
anfc_chips_cleanup(nfc);
break;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 04/12] mtd: rawnand: cadence: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (2 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 03/12] mtd: rawnand: arasan: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 05/12] mtd: rawnand: pl353: " Jinjie Ruan
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop by using for_each_child_of_node_scoped().
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/cadence-nand-controller.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c
index ff92c17def83..3bc89b356963 100644
--- a/drivers/mtd/nand/raw/cadence-nand-controller.c
+++ b/drivers/mtd/nand/raw/cadence-nand-controller.c
@@ -2836,7 +2836,6 @@ static void cadence_nand_chips_cleanup(struct cdns_nand_ctrl *cdns_ctrl)
static int cadence_nand_chips_init(struct cdns_nand_ctrl *cdns_ctrl)
{
struct device_node *np = cdns_ctrl->dev->of_node;
- struct device_node *nand_np;
int max_cs = cdns_ctrl->caps2.max_banks;
int nchips, ret;
@@ -2849,10 +2848,9 @@ static int cadence_nand_chips_init(struct cdns_nand_ctrl *cdns_ctrl)
return -EINVAL;
}
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = cadence_nand_chip_init(cdns_ctrl, nand_np);
if (ret) {
- of_node_put(nand_np);
cadence_nand_chips_cleanup(cdns_ctrl);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 05/12] mtd: rawnand: pl353: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (3 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 04/12] mtd: rawnand: cadence: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 06/12] mtd: rawnand: marvell: drm/rockchip: " Jinjie Ruan
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop by using for_each_child_of_node_scoped().
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/pl35x-nand-controller.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c
index 1c76ee98efb7..2570fd0beea0 100644
--- a/drivers/mtd/nand/raw/pl35x-nand-controller.c
+++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c
@@ -1111,7 +1111,7 @@ static void pl35x_nand_chips_cleanup(struct pl35x_nandc *nfc)
static int pl35x_nand_chips_init(struct pl35x_nandc *nfc)
{
- struct device_node *np = nfc->dev->of_node, *nand_np;
+ struct device_node *np = nfc->dev->of_node;
int nchips = of_get_child_count(np);
int ret;
@@ -1121,10 +1121,9 @@ static int pl35x_nand_chips_init(struct pl35x_nandc *nfc)
return -EINVAL;
}
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = pl35x_nand_chip_init(nfc, nand_np);
if (ret) {
- of_node_put(nand_np);
pl35x_nand_chips_cleanup(nfc);
break;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 06/12] mtd: rawnand: marvell: drm/rockchip: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (4 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 05/12] mtd: rawnand: pl353: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 07/12] mtd: rawnand: rockchip: " Jinjie Ruan
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/marvell_nand.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index 5b0f5a9cef81..26648b72e691 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -2771,7 +2771,6 @@ static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc)
static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
{
struct device_node *np = dev->of_node;
- struct device_node *nand_np;
int max_cs = nfc->caps->max_cs_nb;
int nchips;
int ret;
@@ -2798,20 +2797,15 @@ static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
return ret;
}
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = marvell_nand_chip_init(dev, nfc, nand_np);
if (ret) {
- of_node_put(nand_np);
- goto cleanup_chips;
+ marvell_nand_chips_cleanup(nfc);
+ return ret;
}
}
return 0;
-
-cleanup_chips:
- marvell_nand_chips_cleanup(nfc);
-
- return ret;
}
static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 07/12] mtd: rawnand: rockchip: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (5 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 06/12] mtd: rawnand: marvell: drm/rockchip: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 08/12] mtd: rawnand: meson: " Jinjie Ruan
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/rockchip-nand-controller.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
index 55580447633b..51c9cf9013dc 100644
--- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
+++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
@@ -1211,7 +1211,7 @@ static void rk_nfc_chips_cleanup(struct rk_nfc *nfc)
static int rk_nfc_nand_chips_init(struct device *dev, struct rk_nfc *nfc)
{
- struct device_node *np = dev->of_node, *nand_np;
+ struct device_node *np = dev->of_node;
int nchips = of_get_child_count(np);
int ret;
@@ -1221,10 +1221,9 @@ static int rk_nfc_nand_chips_init(struct device *dev, struct rk_nfc *nfc)
return -EINVAL;
}
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = rk_nfc_nand_chip_init(dev, nfc, nand_np);
if (ret) {
- of_node_put(nand_np);
rk_nfc_chips_cleanup(nfc);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 08/12] mtd: rawnand: meson: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (6 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 07/12] mtd: rawnand: rockchip: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 09/12] mtd: rawnand: mtk: " Jinjie Ruan
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/meson_nand.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 9eb5470344d0..8806a06462ac 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1495,14 +1495,12 @@ static int meson_nfc_nand_chips_init(struct device *dev,
struct meson_nfc *nfc)
{
struct device_node *np = dev->of_node;
- struct device_node *nand_np;
int ret;
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = meson_nfc_nand_chip_init(dev, nfc, nand_np);
if (ret) {
meson_nfc_nand_chip_cleanup(nfc);
- of_node_put(nand_np);
return ret;
}
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 09/12] mtd: rawnand: mtk: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (7 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 08/12] mtd: rawnand: meson: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 10/12] mtd: rawnand: renesas: " Jinjie Ruan
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/mtk_nand.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index 17477bb2d48f..d65e6371675b 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1432,15 +1432,12 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
{
struct device_node *np = dev->of_node;
- struct device_node *nand_np;
int ret;
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = mtk_nfc_nand_chip_init(dev, nfc, nand_np);
- if (ret) {
- of_node_put(nand_np);
+ if (ret)
return ret;
- }
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 10/12] mtd: rawnand: renesas: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (8 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 09/12] mtd: rawnand: mtk: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 11/12] mtd: rawnand: stm32_fmc2: " Jinjie Ruan
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/renesas-nand-controller.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/raw/renesas-nand-controller.c b/drivers/mtd/nand/raw/renesas-nand-controller.c
index c9a01feff8df..0e92d50c5249 100644
--- a/drivers/mtd/nand/raw/renesas-nand-controller.c
+++ b/drivers/mtd/nand/raw/renesas-nand-controller.c
@@ -1297,23 +1297,17 @@ static void rnandc_chips_cleanup(struct rnandc *rnandc)
static int rnandc_chips_init(struct rnandc *rnandc)
{
- struct device_node *np;
int ret;
- for_each_child_of_node(rnandc->dev->of_node, np) {
+ for_each_child_of_node_scoped(rnandc->dev->of_node, np) {
ret = rnandc_chip_init(rnandc, np);
if (ret) {
- of_node_put(np);
- goto cleanup_chips;
+ rnandc_chips_cleanup(rnandc);
+ return ret;
}
}
return 0;
-
-cleanup_chips:
- rnandc_chips_cleanup(rnandc);
-
- return ret;
}
static int rnandc_probe(struct platform_device *pdev)
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 11/12] mtd: rawnand: stm32_fmc2: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (9 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 10/12] mtd: rawnand: renesas: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:28 ` [PATCH -next 12/12] mtd: rawnand: sunxi: " Jinjie Ruan
2024-08-26 8:29 ` [PATCH -next 00/12] mfd: " Krzysztof Kozlowski
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 264556939a00..0f67e96cc240 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -1851,7 +1851,6 @@ static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc,
static int stm32_fmc2_nfc_parse_dt(struct stm32_fmc2_nfc *nfc)
{
struct device_node *dn = nfc->dev->of_node;
- struct device_node *child;
int nchips = of_get_child_count(dn);
int ret = 0;
@@ -1865,12 +1864,10 @@ static int stm32_fmc2_nfc_parse_dt(struct stm32_fmc2_nfc *nfc)
return -EINVAL;
}
- for_each_child_of_node(dn, child) {
+ for_each_child_of_node_scoped(dn, child) {
ret = stm32_fmc2_nfc_parse_child(nfc, child);
- if (ret < 0) {
- of_node_put(child);
+ if (ret < 0)
return ret;
- }
}
return ret;
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH -next 12/12] mtd: rawnand: sunxi: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (10 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 11/12] mtd: rawnand: stm32_fmc2: " Jinjie Ruan
@ 2024-08-26 8:28 ` Jinjie Ruan
2024-08-26 8:29 ` [PATCH -next 00/12] mfd: " Krzysztof Kozlowski
12 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:28 UTC (permalink / raw)
To: lee, linux-kernel, krzk, jic23; +Cc: ruanjinjie
Avoids the need for manual cleanup of_node_put() in early exits
from the loop.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/mtd/nand/raw/sunxi_nand.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 4ec17c8bce5a..c28634e20abf 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -2025,13 +2025,11 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
static int sunxi_nand_chips_init(struct device *dev, struct sunxi_nfc *nfc)
{
struct device_node *np = dev->of_node;
- struct device_node *nand_np;
int ret;
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = sunxi_nand_chip_init(dev, nfc, nand_np);
if (ret) {
- of_node_put(nand_np);
sunxi_nand_chips_cleanup(nfc);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped()
2024-08-26 8:28 [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
` (11 preceding siblings ...)
2024-08-26 8:28 ` [PATCH -next 12/12] mtd: rawnand: sunxi: " Jinjie Ruan
@ 2024-08-26 8:29 ` Krzysztof Kozlowski
2024-08-26 8:58 ` Jinjie Ruan
12 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-26 8:29 UTC (permalink / raw)
To: Jinjie Ruan, lee, linux-kernel, jic23
On 26/08/2024 10:28, Jinjie Ruan wrote:
> Use scoped for_each_available_child_of_node_scoped() when iterating over
> device nodes to make code a bit simpler.
>
> Jinjie Ruan (12):
> mfd: max77620: Use for_each_child_of_node_scoped()
> mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
> mtd: rawnand: arasan: Use for_each_child_of_node_scoped()
No, you are mixing different subsystems. And even did not care to Cc
their maintainers.
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC (and consider --no-git-fallback argument). It might
happen, that command when run on an older kernel, gives you outdated
entries. Therefore please be sure you base your patches on recent Linux
kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about `b4 prep --auto-to-cc` if you added new
patches to the patchset.
</form letter>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH -next 00/12] mfd: Use for_each_child_of_node_scoped()
2024-08-26 8:29 ` [PATCH -next 00/12] mfd: " Krzysztof Kozlowski
@ 2024-08-26 8:58 ` Jinjie Ruan
0 siblings, 0 replies; 15+ messages in thread
From: Jinjie Ruan @ 2024-08-26 8:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, lee, linux-kernel, jic23
On 2024/8/26 16:29, Krzysztof Kozlowski wrote:
> On 26/08/2024 10:28, Jinjie Ruan wrote:
>> Use scoped for_each_available_child_of_node_scoped() when iterating over
>> device nodes to make code a bit simpler.
>>
>> Jinjie Ruan (12):
>> mfd: max77620: Use for_each_child_of_node_scoped()
>> mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
>> mtd: rawnand: arasan: Use for_each_child_of_node_scoped()
>
>
> No, you are mixing different subsystems. And even did not care to Cc
> their maintainers.
OK, I'll resend them.
>
> <form letter>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC (and consider --no-git-fallback argument). It might
> happen, that command when run on an older kernel, gives you outdated
> entries. Therefore please be sure you base your patches on recent Linux
> kernel.
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
> people, so fix your workflow. Tools might also fail if you work on some
> ancient tree (don't, instead use mainline) or work on fork of kernel
> (don't, instead use mainline). Just use b4 and everything should be
> fine, although remember about `b4 prep --auto-to-cc` if you added new
> patches to the patchset.
> </form letter>
Sorry, the low scrip which wrap the `scripts/get_maintainer.pl` has a bug.
>
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 15+ messages in thread