Skip to content

Commit 9c252f3

Browse files
krzkandersson
authored andcommitted
bus: qcom-ebi2: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260102125030.65186-3-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 6c4bbcd commit 9c252f3

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/bus/qcom-ebi2.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ static void qcom_ebi2_setup_chipselect(struct device_node *np,
292292
static int qcom_ebi2_probe(struct platform_device *pdev)
293293
{
294294
struct device_node *np = pdev->dev.of_node;
295-
struct device_node *child;
296295
struct device *dev = &pdev->dev;
297296
struct resource *res;
298297
void __iomem *ebi2_base;
@@ -348,15 +347,13 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
348347
writel(val, ebi2_base);
349348

350349
/* Walk over the child nodes and see what chipselects we use */
351-
for_each_available_child_of_node(np, child) {
350+
for_each_available_child_of_node_scoped(np, child) {
352351
u32 csindex;
353352

354353
/* Figure out the chipselect */
355354
ret = of_property_read_u32(child, "reg", &csindex);
356-
if (ret) {
357-
of_node_put(child);
355+
if (ret)
358356
return ret;
359-
}
360357

361358
if (csindex > 5) {
362359
dev_err(dev,

0 commit comments

Comments
 (0)