linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Bill Wendling <morbo@google.com>,
	linux-serial@vger.kernel.org,
	Justin Stitt <justinstitt@google.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] tty: hvc-iucv: fix function pointer casts
Date: Wed, 14 Feb 2024 07:25:10 +0100	[thread overview]
Message-ID: <7b9afb8f-6642-4921-a92a-90c9074a48b7@kernel.org> (raw)
In-Reply-To: <20240213101756.461701-1-arnd@kernel.org>

On 13. 02. 24, 11:17, Arnd Bergmann wrote:
> 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>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> 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);

-- 
js
suse labs


      parent reply	other threads:[~2024-02-14  6:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b9afb8f-6642-4921-a92a-90c9074a48b7@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).