firmware: arm_scmi: Use WARN_ON() to check configured transports
authorCristian Marussi <cristian.marussi@arm.com>
Mon, 9 Aug 2021 09:22:45 +0000 (10:22 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 9 Aug 2021 10:43:32 +0000 (11:43 +0100)
Use a WARN_ON() when SCMI stack is loaded to check the consistency of
configured SCMI transports instead of the current compile-time check
BUILD_BUG_ON() to avoid breaking bot-builds on random bad configs.

Bail-out early and noisy during SCMI stack initialization if no transport
was enabled in configuration since SCMI cannot work without at least one
enabled transport and such constraint cannot be enforced in Kconfig due to
circular dependency issues.

Link: https://lore.kernel.org/r/20210809092245.8730-1-cristian.marussi@arm.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/driver.c

index b28111e..b406b3f 100644 (file)
@@ -2067,9 +2067,11 @@ static int __init scmi_driver_init(void)
 {
        int ret;
 
-       scmi_bus_init();
+       /* Bail out if no SCMI transport was configured */
+       if (WARN_ON(!IS_ENABLED(CONFIG_ARM_SCMI_HAVE_TRANSPORT)))
+               return -EINVAL;
 
-       BUILD_BUG_ON(!IS_ENABLED(CONFIG_ARM_SCMI_HAVE_TRANSPORT));
+       scmi_bus_init();
 
        /* Initialize any compiled-in transport which provided an init/exit */
        ret = scmi_transports_init();