From: Danilo Krummrich <dakr@redhat.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Ben Skeggs <bskeggs@redhat.com>,
dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>
Subject: Re: [PATCH] [v2] nouveau: fix function cast warning
Date: Fri, 5 Apr 2024 18:37:57 +0200 [thread overview]
Message-ID: <cefb67c2-f5f5-4b54-8ed6-a9cab3718ff5@redhat.com> (raw)
In-Reply-To: <20240404160234.2923554-1-arnd@kernel.org>
On 4/4/24 18:02, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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>
Applied to drm-misc-fixes, thanks!
> ---
> v2: avoid 'return kfree()' expression returning a void
> ---
> drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
> index 4bf486b57101..cb05f7f48a98 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
> @@ -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,
prev parent reply other threads:[~2024-04-05 16:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 16:02 [PATCH] [v2] nouveau: fix function cast warning Arnd Bergmann
2024-04-05 16:37 ` Danilo Krummrich [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=cefb67c2-f5f5-4b54-8ed6-a9cab3718ff5@redhat.com \
--to=dakr@redhat.com \
--cc=airlied@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=justinstitt@google.com \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=lyude@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nouveau@lists.freedesktop.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).