Skip to content

Commit cf770af

Browse files
arndbjdelvare
authored andcommitted
firmware: dmi-id: add a release callback function
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: 4f5c791 ("DMI-based module autoloading") Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
1 parent e8f897f commit cf770af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/firmware/dmi-id.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
169169
return 0;
170170
}
171171

172+
static void dmi_dev_release(struct device *dev)
173+
{
174+
kfree(dev);
175+
}
176+
172177
static struct class dmi_class = {
173178
.name = "dmi",
174-
.dev_release = (void(*)(struct device *)) kfree,
179+
.dev_release = dmi_dev_release,
175180
.dev_uevent = dmi_dev_uevent,
176181
};
177182

0 commit comments

Comments
 (0)