nouveau: fix function cast warning
authorArnd Bergmann <arnd@arndb.de>
Thu, 4 Apr 2024 16:02:25 +0000 (18:02 +0200)
committerDanilo Krummrich <dakr@redhat.com>
Fri, 5 Apr 2024 16:30:29 +0000 (18:30 +0200)
Calling a function through an incompatible pointer type causes breaks
kcfi, so clang warns about the assignment:

drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c:73:10: error: cast from 'void (*)(const void *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   73 |         .fini = (void(*)(void *))kfree,

Avoid this with a trivial wrapper.

Fixes: c39f472e9f14 ("drm/nouveau: remove symlinks, move core/ to nvkm/ (no code changes)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240404160234.2923554-1-arnd@kernel.org
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c

index 4bf486b57101367708bba2b6fe4bdd1d985f1d19..cb05f7f48a98bb53fc3e03b57166466c675acd7c 100644 (file)
@@ -66,11 +66,16 @@ of_init(struct nvkm_bios *bios, const char *name)
        return ERR_PTR(-EINVAL);
 }
 
+static void of_fini(void *p)
+{
+       kfree(p);
+}
+
 const struct nvbios_source
 nvbios_of = {
        .name = "OpenFirmware",
        .init = of_init,
-       .fini = (void(*)(void *))kfree,
+       .fini = of_fini,
        .read = of_read,
        .size = of_size,
        .rw = false,