[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240830063228.3519385-4-ruanjinjie@huawei.com>
Date: Fri, 30 Aug 2024 14:32:27 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <nm@...com>, <ssantosh@...nel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <krzk@...nel.org>, <jic23@...nel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH -next v2 3/4] soc: ti: knav_qmss_queue: Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
v2:
- Split into 2 patches.
- Rebased the newest next.
- Update the commit message.
---
drivers/soc/ti/knav_qmss_queue.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 6c98738e548a..02983f8ba1b6 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -1082,7 +1082,6 @@ static int knav_queue_setup_regions(struct knav_device *kdev,
struct device_node *regions __free(device_node) =
of_get_child_by_name(node, "descriptor-regions");
struct knav_region *region;
- struct device_node *child;
u32 temp[2];
int ret;
@@ -1090,10 +1089,9 @@ static int knav_queue_setup_regions(struct knav_device *kdev,
return dev_err_probe(dev, -ENODEV,
"descriptor-regions not specified\n");
- for_each_child_of_node(regions, child) {
+ for_each_child_of_node_scoped(regions, child) {
region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL);
if (!region) {
- of_node_put(child);
dev_err(dev, "out of memory allocating region\n");
return -ENOMEM;
}
@@ -1400,7 +1398,6 @@ static int knav_queue_init_qmgrs(struct knav_device *kdev,
struct device_node *qmgrs __free(device_node) =
of_get_child_by_name(node, "qmgrs");
struct knav_qmgr_info *qmgr;
- struct device_node *child;
u32 temp[2];
int ret;
@@ -1408,10 +1405,9 @@ static int knav_queue_init_qmgrs(struct knav_device *kdev,
return dev_err_probe(dev, -ENODEV,
"queue manager info not specified\n");
- for_each_child_of_node(qmgrs, child) {
+ for_each_child_of_node_scoped(qmgrs, child) {
qmgr = devm_kzalloc(dev, sizeof(*qmgr), GFP_KERNEL);
if (!qmgr) {
- of_node_put(child);
dev_err(dev, "out of memory allocating qmgr\n");
return -ENOMEM;
}
@@ -1506,12 +1502,10 @@ static int knav_queue_init_pdsps(struct knav_device *kdev,
{
struct device *dev = kdev->dev;
struct knav_pdsp_info *pdsp;
- struct device_node *child;
- for_each_child_of_node(pdsps, child) {
+ for_each_child_of_node_scoped(pdsps, child) {
pdsp = devm_kzalloc(dev, sizeof(*pdsp), GFP_KERNEL);
if (!pdsp) {
- of_node_put(child);
dev_err(dev, "out of memory allocating pdsp\n");
return -ENOMEM;
}
--
2.34.1
Powered by blists - more mailing lists