diff mbox series

[meta-security] dm-verity-img: Fix warning when included but unused

Message ID 20260212113724.2940142-2-frederikbraendstrup@gmail.com
State New
Headers show
Series [meta-security] dm-verity-img: Fix warning when included but unused | expand

Commit Message

Frederik Brændstrup Feb. 12, 2026, 11:37 a.m. UTC
The `get_verity_fstypes` function is used in the expansion of
`IMAGE_FSTYPES` right below this function, so if verity_image or
verity_type is unset, we should warn here. The original warning
in the __anonymous block below, is never reached, because the expansion
of IMAGE_FSTYPES results in a parsing error

Signed-off-by: Frede Hoey Braendstrup <frederikbraendstrup@gmail.com>
---
 classes/dm-verity-img.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--
diff mbox series

Patch

diff --git a/classes/dm-verity-img.bbclass b/classes/dm-verity-img.bbclass
index 48557e9..73297ca 100644
--- a/classes/dm-verity-img.bbclass
+++ b/classes/dm-verity-img.bbclass
@@ -187,6 +187,10 @@  def get_verity_fstypes(d):
     verity_hash = d.getVar('DM_VERITY_SEPARATE_HASH')
     pn = d.getVar('PN')
 
+    if not verity_image or not verity_type:
+        bb.warnonce('dm-verity-img class inherited in %s but not used' % pn)
+        return ""
+
     fstypes = ""
     if not pn.endswith(verity_image):
         return fstypes # This doesn't concern this image
@@ -207,7 +211,6 @@  python __anonymous() {
     pn = d.getVar('PN')
 
     if not verity_image or not verity_type:
-        bb.warn('dm-verity-img class inherited but not used')
         return
 
     if not pn.endswith(verity_image):