* [PATCH][next] drm/i915/gem: Fix fall-through warning for Clang
@ 2021-06-07 20:32 Gustavo A. R. Silva
2021-06-07 20:57 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2021-06-07 20:32 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter
Cc: intel-gfx, dri-devel, linux-kernel, Gustavo A. R. Silva,
linux-hardening, Kees Cook
In preparation to enable -Wimplicit-fallthrough for Clang, fix a
warning by explicitly adding a fallthrough; statement.
Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
JFYI: We had thousands of these sorts of warnings and now we are down
to just 13 in linux-next(20210607). This is one of those last
remaining warnings. :)
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
index f4fb68e8955a..17714da24033 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
@@ -62,6 +62,7 @@ static void try_to_writeback(struct drm_i915_gem_object *obj,
switch (obj->mm.madv) {
case I915_MADV_DONTNEED:
i915_gem_object_truncate(obj);
+ fallthrough;
case __I915_MADV_PURGED:
return;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] drm/i915/gem: Fix fall-through warning for Clang
2021-06-07 20:32 [PATCH][next] drm/i915/gem: Fix fall-through warning for Clang Gustavo A. R. Silva
@ 2021-06-07 20:57 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-06-07 20:57 UTC (permalink / raw)
To: Gustavo A. R. Silva, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter
Cc: intel-gfx, dri-devel, linux-kernel, linux-hardening, Kees Cook
On Mon, 2021-06-07 at 15:32 -0500, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a
> warning by explicitly adding a fallthrough; statement.
[]
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
[]
> @@ -62,6 +62,7 @@ static void try_to_writeback(struct drm_i915_gem_object *obj,
> switch (obj->mm.madv) {
> case I915_MADV_DONTNEED:
> i915_gem_object_truncate(obj);
> + fallthrough;
> case __I915_MADV_PURGED:
> return;
> }
I think fallthrough to return is not particularly nice to follow.
This is the current function:
static void try_to_writeback(struct drm_i915_gem_object *obj,
unsigned int flags)
{
switch (obj->mm.madv) {
case I915_MADV_DONTNEED:
i915_gem_object_truncate(obj);
case __I915_MADV_PURGED:
return;
}
if (flags & I915_SHRINK_WRITEBACK)
i915_gem_object_writeback(obj);
}
One of these might be more typical:
static void try_to_writeback(struct drm_i915_gem_object *obj,
unsigned int flags)
{
switch (obj->mm.madv) {
case I915_MADV_DONTNEED:
i915_gem_object_truncate(obj);
break;
case __I915_MADV_PURGED:
break;
default:
if (flags & I915_SHRINK_WRITEBACK)
i915_gem_object_writeback(obj);
break;
}
}
or maybe:
static void try_to_writeback(struct drm_i915_gem_object *obj,
unsigned int flags)
{
switch (obj->mm.madv) {
case I915_MADV_DONTNEED:
i915_gem_object_truncate(obj);
return;
case __I915_MADV_PURGED:
return;
}
if (flags & I915_SHRINK_WRITEBACK)
i915_gem_object_writeback(obj);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-07 20:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 20:32 [PATCH][next] drm/i915/gem: Fix fall-through warning for Clang Gustavo A. R. Silva
2021-06-07 20:57 ` Joe Perches
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).