firmware: dmi-id: add a release callback function
PATCH 1/1 firmware: dmi-id: add a release callback function
From: Arnd Bergmann <[email protected]>
dmi_class uses kfree() as the .release function, but that now causes a warning with clang-16 as it violates control flow integrity (KCFI) rules:
drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
174 | .dev_release = (void(*)(struct device *)) kfree,
Add an explicit function to call kfree() instead.
Fixes 4f5c791a850e ("DMI-based module autoloading")
Signed-off-by Arnd Bergmann <[email protected]>
--- drivers/firmware/dmi-id.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/firmware/dmi-id.c +6 -1
@@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static void dmi_dev_release (struct device *dev) +{ +kfree (dev); +} +static struct class dmi_class = { .name ="dmi" , - .dev_release = (void (*)(struct device *)) kfree, + .dev_release = dmi_dev_release, .dev_uevent = dmi_dev_uevent, };
Signature · 1 line
2.39.2