From: Geert Uytterhoeven Date: Mon, 16 Mar 2026 15:34:40 +0000 (+0100) Subject: firmware: arm_scmi: Support loop control in quirk code snippets X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a7ec808abecaf0d5c3ecc0d1b87d58f29c85604;p=thirdparty%2Fkernel%2Fstable.git firmware: arm_scmi: Support loop control in quirk code snippets Each SCMI firmware quirk contains a code snippet, which handles the quirk, and has full access to the surrounding context. When this context is (part of) a loop body, the code snippet may want to use loop control statements like "break" and "continue". Unfortunately the SCMI_QUIRK() macro implementation contains a dummy loop, taking precedence over any outer loops. Hence quirk code cannot use loop control statements, but has to resort to polluting the surrounding context with a label, and use goto. Fix this by replacing the "do { ... } while (0)" construct in the SCMI_QUIRK() implementation by "({ ... })". Signed-off-by: Geert Uytterhoeven Reviewed-by: Cristian Marussi Reviewed-by: Peng Fan Message-Id: <51de914cddef8fa86c2e7dd5397e5df759c45464.1773675224.git.geert+renesas@glider.be> Signed-off-by: Sudeep Holla --- diff --git a/drivers/firmware/arm_scmi/quirks.h b/drivers/firmware/arm_scmi/quirks.h index a71fde85a527..d8ba60b95652 100644 --- a/drivers/firmware/arm_scmi/quirks.h +++ b/drivers/firmware/arm_scmi/quirks.h @@ -20,10 +20,10 @@ * named as _qn. */ #define SCMI_QUIRK(_qn, _blk) \ - do { \ + ({ \ if (static_branch_unlikely(&(scmi_quirk_ ## _qn))) \ (_blk); \ - } while (0) + }) void scmi_quirks_initialize(void); void scmi_quirks_enable(struct device *dev, const char *vend, @@ -34,10 +34,10 @@ void scmi_quirks_enable(struct device *dev, const char *vend, #define DECLARE_SCMI_QUIRK(_qn) /* Force quirks compilation even when SCMI Quirks are disabled */ #define SCMI_QUIRK(_qn, _blk) \ - do { \ + ({ \ if (0) \ (_blk); \ - } while (0) + }) static inline void scmi_quirks_initialize(void) { } static inline void scmi_quirks_enable(struct device *dev, const char *vend,