Skip to contentSkip to conversation

nouveau: fix function cast warnings

PATCH Applied Arnd Bergmann 2 participants 2 messages Feb 13, 2024 – Feb 16, 2024

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: fix function cast warnings

From: Arnd Bergmann <[email protected]>

clang-16 warns about casting between incompatible function types:

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

This one was done to use the generic shadow_fw_release() function as a callback for struct nvbios_source. Change it to use the same prototype as the other five instances, with a trivial helper function that actually calls release_firmware.

Fixes 70c0f263cc2e ("drm/nouveau/bios: pull in basic vbios subdev, more to come later")
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +7 -1
index 19188683c8fc..8c2bf1c16f2a 100644
@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name)
 	return (void *)fw;
 }
 
+static void
+shadow_fw_release(void *fw)
+{
+	release_firmware(fw);
+}
+
 static const struct nvbios_source
 shadow_fw = {
 	.name = "firmware",
 	.init = shadow_fw_init,
-	.fini = (void(*)(void *))release_firmware,
+	.fini = shadow_fw_release,
 	.read = shadow_fw_read,
 	.rw = false,
 };
Signature · 1 line
2.39.2
#1 lore raw
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang-16 warns about casting between incompatible function types:

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

Quoted 7 lines

This one was done to use the generic shadow_fw_release() function as a callback for struct nvbios_source. Change it to use the same prototype as the other five instances, with a trivial helper function that actually calls release_firmware.

Fixes 70c0f263cc2e ("drm/nouveau/bios: pull in basic vbios subdev, more to come later")

Applied to drm-misc-fixes, thanks!

Quoted 27 lines
---
  drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +7 -1
index 19188683c8fc..8c2bf1c16f2a 100644
@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name)
  	return (void *)fw;
  }
 
+static void
+shadow_fw_release(void *fw)
+{
+	release_firmware(fw);
+}
+
  static const struct nvbios_source
  shadow_fw = {
  	.name = "firmware",
  	.init = shadow_fw_init,
-	.fini = (void(*)(void *))release_firmware,
+	.fini = shadow_fw_release,
  	.read = shadow_fw_read,
  	.rw = false,
  };