linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: hvc-iucv: fix function pointer casts
@ 2024-02-13 10:17 Arnd Bergmann
  2024-02-13 19:12 ` Segher Boessenkool
  2024-02-14  6:25 ` Jiri Slaby
  0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2024-02-13 10:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Arnd Bergmann, llvm, Nick Desaulniers, linux-kernel,
	Nathan Chancellor, Bill Wendling, linux-serial, Justin Stitt,
	linuxppc-dev

From: Arnd Bergmann <arnd@arndb.de>

clang warns about explicitly casting between incompatible function
pointers:

drivers/tty/hvc/hvc_iucv.c:1100:23: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1100 |         priv->dev->release = (void (*)(struct device *)) kfree;
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add a separate function to handle this correctly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/hvc/hvc_iucv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c
index fdecc0d63731..b1149bc62ca1 100644
--- a/drivers/tty/hvc/hvc_iucv.c
+++ b/drivers/tty/hvc/hvc_iucv.c
@@ -1035,6 +1035,10 @@ static const struct attribute_group *hvc_iucv_dev_attr_groups[] = {
 	NULL,
 };
 
+static void hvc_iucv_free(struct device *data)
+{
+	kfree(data);
+}
 
 /**
  * hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance
@@ -1097,7 +1101,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
 	priv->dev->bus = &iucv_bus;
 	priv->dev->parent = iucv_root;
 	priv->dev->groups = hvc_iucv_dev_attr_groups;
-	priv->dev->release = (void (*)(struct device *)) kfree;
+	priv->dev->release = hvc_iucv_free;
 	rc = device_register(priv->dev);
 	if (rc) {
 		put_device(priv->dev);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-14 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 10:17 [PATCH] tty: hvc-iucv: fix function pointer casts Arnd Bergmann
2024-02-13 19:12 ` Segher Boessenkool
2024-02-14  9:46   ` David Laight
2024-02-14 10:37     ` Greg Kroah-Hartman
2024-02-14 12:36       ` Segher Boessenkool
2024-02-14  6:25 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).