console: Add format-checking __printf() to die()

Code changes are necessary because `-Wformat` warns about empty
format strings by default.

Change-Id: Ic8021b70f4cd4875b06f196f88b84940c9a79fe0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75147
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Nico Huber
2023-05-12 15:46:24 +02:00
committed by Felix Held
parent feba51ba17
commit 6a07db21b1
4 changed files with 6 additions and 13 deletions

View File

@@ -405,11 +405,8 @@ struct resource *find_resource(const struct device *dev, unsigned int index)
/* See if there is a resource with the appropriate index. */ /* See if there is a resource with the appropriate index. */
resource = probe_resource(dev, index); resource = probe_resource(dev, index);
if (!resource) { if (!resource)
printk(BIOS_EMERG, "%s missing resource: %02x\n", die("%s missing resource: %02x\n", dev_path(dev), index);
dev_path(dev), index);
die("");
}
return resource; return resource;
} }

View File

@@ -8,11 +8,8 @@
struct bus *get_pbus_smbus(struct device *dev) struct bus *get_pbus_smbus(struct device *dev)
{ {
struct bus *const pbus = i2c_link(dev); struct bus *const pbus = i2c_link(dev);
if (!pbus->dev->ops->ops_smbus_bus) { if (!pbus->dev->ops->ops_smbus_bus)
printk(BIOS_ALERT, "%s Cannot find SMBus bus operations", die("%s Cannot find SMBus bus operations", dev_path(dev));
dev_path(dev));
die("");
}
return pbus; return pbus;
} }

View File

@@ -18,7 +18,7 @@ void mainboard_post(u8 value);
void arch_post_code(u8 value); void arch_post_code(u8 value);
void soc_post_code(uint8_t value); void soc_post_code(uint8_t value);
void __noreturn die(const char *fmt, ...); void __noreturn __printf(1, 2) die(const char *fmt, ...);
#define die_with_post_code(value, fmt, ...) \ #define die_with_post_code(value, fmt, ...) \
do { post_code(value); die(fmt, ##__VA_ARGS__); } while (0) do { post_code(value); die(fmt, ##__VA_ARGS__); } while (0)

View File

@@ -40,8 +40,7 @@ static RES_TYPE get_res_type(uint64_t flags)
/* both 64-bit and 32-bit use below 4GB address space */ /* both 64-bit and 32-bit use below 4GB address space */
return RES_TYPE_NONPREF_MEM; return RES_TYPE_NONPREF_MEM;
} }
printk(BIOS_ERR, "Invalid resource type 0x%llx\n", flags); die("Invalid resource type 0x%llx\n", flags);
die("");
} }
static bool need_assignment(uint64_t flags) static bool need_assignment(uint64_t flags)