]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/nouveau-fix-function-cast-warning.patch
6.1-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / nouveau-fix-function-cast-warning.patch
1 From b7ac1346d69bd2e93a82d6360f6f93eeee1f9949 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 4 Apr 2024 18:02:25 +0200
4 Subject: nouveau: fix function cast warning
5
6 From: Arnd Bergmann <arnd@arndb.de>
7
8 [ Upstream commit 185fdb4697cc9684a02f2fab0530ecdd0c2f15d4 ]
9
10 Calling a function through an incompatible pointer type causes breaks
11 kcfi, so clang warns about the assignment:
12
13 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]
14 73 | .fini = (void(*)(void *))kfree,
15
16 Avoid this with a trivial wrapper.
17
18 Fixes: c39f472e9f14 ("drm/nouveau: remove symlinks, move core/ to nvkm/ (no code changes)")
19 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
20 Signed-off-by: Danilo Krummrich <dakr@redhat.com>
21 Link: https://patchwork.freedesktop.org/patch/msgid/20240404160234.2923554-1-arnd@kernel.org
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 ---
24 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c | 7 ++++++-
25 1 file changed, 6 insertions(+), 1 deletion(-)
26
27 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
28 index 4bf486b571013..cb05f7f48a98b 100644
29 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
30 +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
31 @@ -66,11 +66,16 @@ of_init(struct nvkm_bios *bios, const char *name)
32 return ERR_PTR(-EINVAL);
33 }
34
35 +static void of_fini(void *p)
36 +{
37 + kfree(p);
38 +}
39 +
40 const struct nvbios_source
41 nvbios_of = {
42 .name = "OpenFirmware",
43 .init = of_init,
44 - .fini = (void(*)(void *))kfree,
45 + .fini = of_fini,
46 .read = of_read,
47 .size = of_size,
48 .rw = false,
49 --
50 2.43.0
51