The err_undo label in alloc_from_freetree() is only reachable via a
goto from inside the `while (tmp != order)` loop, which means tmp is
guaranteed to differ from order at that point. The surrounding
`if (tmp != order)` guard was therefore always true and can be dropped
without any behavioral change.

Signed-off-by: Francois Dugast <[email protected]>
---
 drivers/gpu/buddy.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/buddy.c b/drivers/gpu/buddy.c
index dac2027bb64a..9f6696f47f89 100644
--- a/drivers/gpu/buddy.c
+++ b/drivers/gpu/buddy.c
@@ -849,10 +849,8 @@ alloc_from_freetree(struct gpu_buddy *mm,
        return block;
 
 err_undo:
-       if (tmp != order) {
-               rbtree_remove(mm, block);
-               __gpu_buddy_free(mm, block, false);
-       }
+       rbtree_remove(mm, block);
+       __gpu_buddy_free(mm, block, false);
        return ERR_PTR(err);
 }
 
-- 
2.43.0

Reply via email to