From 62f3b2a86710279146724cb1bdab5e50bcc5b304 Mon Sep 17 00:00:00 2001 From: Michal Orzel Date: Wed, 15 Apr 2026 13:36:58 +0200 Subject: [PATCH] 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 Reviewed-by: Luca Fancellu Acked-by: Stefano Stabellini --- 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,