Skip to content

Commit 2ff81fe

Browse files
krzkrobherring
authored andcommitted
cdx: 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: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20260109-of-for-each-compatible-scoped-v3-6-c22fa2c0749a@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 9572933 commit 2ff81fe

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/cdx/cdx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,6 @@ static ssize_t rescan_store(const struct bus_type *bus,
608608
{
609609
struct cdx_controller *cdx;
610610
struct platform_device *pd;
611-
struct device_node *np;
612611
bool val;
613612

614613
if (kstrtobool(buf, &val) < 0)
@@ -623,10 +622,9 @@ static ssize_t rescan_store(const struct bus_type *bus,
623622
cdx_unregister_devices(&cdx_bus_type);
624623

625624
/* Rescan all the devices */
626-
for_each_compatible_node(np, NULL, compat_node_name) {
625+
for_each_compatible_node_scoped(np, NULL, compat_node_name) {
627626
pd = of_find_device_by_node(np);
628627
if (!pd) {
629-
of_node_put(np);
630628
count = -EINVAL;
631629
goto unlock;
632630
}

0 commit comments

Comments
 (0)