From de85a208a04dc875e95222ca180a026e97699503 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 9 Oct 2023 10:48:50 +0200 Subject: [PATCH] cmake: extensions: Robustify dt_node_has_status Calling this function with an output variable named `var` or `okay` could produce an incorrect result, due to the variable being mishandled. Add simple changes to avoid this. Signed-off-by: Grzegorz Swiderski --- cmake/modules/extensions.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 1e38ae7ba72..0c79947cd37 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -3267,13 +3267,13 @@ function(dt_node_has_status var) return() endif() - dt_prop(${var} PATH ${canonical} PROPERTY status) + dt_prop(status PATH ${canonical} PROPERTY status) - if(NOT DEFINED ${var} OR "${${var}}" STREQUAL ok) - set(${var} okay) + if(NOT DEFINED status OR status STREQUAL "ok") + set(status "okay") endif() - if(${var} STREQUAL ${DT_NODE_STATUS}) + if(status STREQUAL "${DT_NODE_STATUS}") set(${var} TRUE PARENT_SCOPE) else() set(${var} FALSE PARENT_SCOPE)