* [PATCH] drm/xe: avoid function cast warnings
@ 2024-02-13 9:56 Arnd Bergmann
2024-02-13 10:04 ` Thomas Hellström
2024-02-14 10:10 ` Thomas Hellström
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2024-02-13 9:56 UTC (permalink / raw)
To: Lucas De Marchi, Oded Gabbay, Thomas Hellström
Cc: Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
intel-xe, dri-devel, linux-kernel, llvm
From: Arnd Bergmann <arnd@arndb.de>
clang-16 warns about a cast between incompatible function types:
drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
155 | .free = (void (*)(struct xe_range_fence *rfence)) kfree,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Avoid this with a trivial helper function that calls kfree() here.
Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_range_fence.c b/drivers/gpu/drm/xe/xe_range_fence.c
index d35d9ec58e86..8510be4466eb 100644
--- a/drivers/gpu/drm/xe/xe_range_fence.c
+++ b/drivers/gpu/drm/xe/xe_range_fence.c
@@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence *rfence, u64 start, u64 last)
return xe_range_fence_tree_iter_next(rfence, start, last);
}
+static void xe_range_fence_free(struct xe_range_fence * rfence)
+{
+ kfree(rfence);
+}
+
const struct xe_range_fence_ops xe_range_fence_kfree_ops = {
- .free = (void (*)(struct xe_range_fence *rfence)) kfree,
+ .free = xe_range_fence_free,
};
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: avoid function cast warnings
2024-02-13 9:56 [PATCH] drm/xe: avoid function cast warnings Arnd Bergmann
@ 2024-02-13 10:04 ` Thomas Hellström
2024-02-14 10:10 ` Thomas Hellström
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Hellström @ 2024-02-13 10:04 UTC (permalink / raw)
To: Arnd Bergmann, Lucas De Marchi, Oded Gabbay
Cc: Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
intel-xe, dri-devel, linux-kernel, llvm
On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang-16 warns about a cast between incompatible function types:
>
> drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void
> (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to
> incompatible function type [-Werror,-Wcast-function-type-strict]
> 155 | .free = (void (*)(struct xe_range_fence *rfence))
> kfree,
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Avoid this with a trivial helper function that calls kfree() here.
>
> Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks, will push as soon as it passes CI.
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_range_fence.c
> b/drivers/gpu/drm/xe/xe_range_fence.c
> index d35d9ec58e86..8510be4466eb 100644
> --- a/drivers/gpu/drm/xe/xe_range_fence.c
> +++ b/drivers/gpu/drm/xe/xe_range_fence.c
> @@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence
> *rfence, u64 start, u64 last)
> return xe_range_fence_tree_iter_next(rfence, start, last);
> }
>
> +static void xe_range_fence_free(struct xe_range_fence * rfence)
> +{
> + kfree(rfence);
> +}
> +
> const struct xe_range_fence_ops xe_range_fence_kfree_ops = {
> - .free = (void (*)(struct xe_range_fence *rfence)) kfree,
> + .free = xe_range_fence_free,
> };
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: avoid function cast warnings
2024-02-13 9:56 [PATCH] drm/xe: avoid function cast warnings Arnd Bergmann
2024-02-13 10:04 ` Thomas Hellström
@ 2024-02-14 10:10 ` Thomas Hellström
2024-02-14 10:15 ` Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Hellström @ 2024-02-14 10:10 UTC (permalink / raw)
To: Arnd Bergmann, Lucas De Marchi, Oded Gabbay
Cc: Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
intel-xe, dri-devel, linux-kernel, llvm
Hi,
On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang-16 warns about a cast between incompatible function types:
>
> drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void
> (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to
> incompatible function type [-Werror,-Wcast-function-type-strict]
> 155 | .free = (void (*)(struct xe_range_fence *rfence))
> kfree,
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Avoid this with a trivial helper function that calls kfree() here.
>
> Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_range_fence.c
> b/drivers/gpu/drm/xe/xe_range_fence.c
> index d35d9ec58e86..8510be4466eb 100644
> --- a/drivers/gpu/drm/xe/xe_range_fence.c
> +++ b/drivers/gpu/drm/xe/xe_range_fence.c
> @@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence
> *rfence, u64 start, u64 last)
> return xe_range_fence_tree_iter_next(rfence, start, last);
> }
>
> +static void xe_range_fence_free(struct xe_range_fence * rfence)
There's a checkpatch.pl style error above: s/* rfence/*rfence/. I can
fix that up when pushing if it's ok with you.
/Thomas
> +{
> + kfree(rfence);
> +}
> +
> const struct xe_range_fence_ops xe_range_fence_kfree_ops = {
> - .free = (void (*)(struct xe_range_fence *rfence)) kfree,
> + .free = xe_range_fence_free,
> };
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: avoid function cast warnings
2024-02-14 10:10 ` Thomas Hellström
@ 2024-02-14 10:15 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2024-02-14 10:15 UTC (permalink / raw)
To: Thomas Hellström, Arnd Bergmann, Lucas De Marchi, Oded Gabbay
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Dave Airlie,
Daniel Vetter, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, intel-xe, dri-devel, linux-kernel,
llvm
On Wed, Feb 14, 2024, at 11:10, Thomas Hellström wrote:
> On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote:
>>
>> +static void xe_range_fence_free(struct xe_range_fence * rfence)
>
> There's a checkpatch.pl style error above: s/* rfence/*rfence/. I can
> fix that up when pushing if it's ok with you.
Right, I saw the report. Please fix it up then so I don't have
to resubmit. Thanks,
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-14 10:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 9:56 [PATCH] drm/xe: avoid function cast warnings Arnd Bergmann
2024-02-13 10:04 ` Thomas Hellström
2024-02-14 10:10 ` Thomas Hellström
2024-02-14 10:15 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®