[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/dt-overlay: fix silent success in dt_overlay_remove_node



commit 62f3b2a86710279146724cb1bdab5e50bcc5b304
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Wed Apr 15 13:36:58 2026 +0200
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Wed Apr 29 07:37:58 2026 +0200

    xen/dt-overlay: fix silent success in dt_overlay_remove_node
    
    dt_overlay_remove_node() silently returns 0 when the target node is not
    found in the parent's sibling list.  The loop simply exits without
    matching and falls through to "return 0", making the caller believe the
    node was successfully removed.
    
    Return -ENODEV after the loop when no match is found, and change the
    found-path from break to an explicit return 0 so the two outcomes are
    distinct.
    
    Fixes: 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal 
functionalities")
    Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
    Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/common/device-tree/dt-overlay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/device-tree/dt-overlay.c 
b/xen/common/device-tree/dt-overlay.c
index 0eed1532a1..d3d4669718 100644
--- a/xen/common/device-tree/dt-overlay.c
+++ b/xen/common/device-tree/dt-overlay.c
@@ -125,11 +125,11 @@ static int dt_overlay_remove_node(struct dt_device_node 
*device_node)
             else
                 np->allnext = np->allnext->allnext;
 
-            break;
+            return 0;
         }
     }
 
-    return 0;
+    return -ENODEV;
 }
 
 static int dt_overlay_add_node(struct dt_device_node *device_node,
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.