* [PATCH] drm/panthor: clean up some types in panthor_sched_suspend()
@ 2024-04-08 7:36 Dan Carpenter
2024-04-08 12:27 ` Steven Price
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-04-08 7:36 UTC (permalink / raw
To: Boris Brezillon
Cc: Steven Price, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, dri-devel,
linux-kernel, kernel-janitors
These variables should be u32 instead of u64 because they're only
storing u32 values. Also static checkers complain when we do:
suspended_slots &= ~upd_ctx.timedout_mask;
In this code "suspended_slots" is a u64 and "upd_ctx.timedout_mask". The
mask clears out the top 32 bits which would likely be a bug if anything
were stored there.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index d4bc652b34d5..b3a51a6de523 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -2546,7 +2546,7 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
{
struct panthor_scheduler *sched = ptdev->scheduler;
struct panthor_csg_slots_upd_ctx upd_ctx;
- u64 suspended_slots, faulty_slots;
+ u32 suspended_slots, faulty_slots;
struct panthor_group *group;
u32 i;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: clean up some types in panthor_sched_suspend()
2024-04-08 7:36 [PATCH] drm/panthor: clean up some types in panthor_sched_suspend() Dan Carpenter
@ 2024-04-08 12:27 ` Steven Price
2024-04-17 9:29 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Steven Price @ 2024-04-08 12:27 UTC (permalink / raw
To: Dan Carpenter, Boris Brezillon
Cc: Liviu Dudau, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, dri-devel, linux-kernel,
kernel-janitors
On 08/04/2024 08:36, Dan Carpenter wrote:
> These variables should be u32 instead of u64 because they're only
> storing u32 values. Also static checkers complain when we do:
>
> suspended_slots &= ~upd_ctx.timedout_mask;
>
> In this code "suspended_slots" is a u64 and "upd_ctx.timedout_mask". The
> mask clears out the top 32 bits which would likely be a bug if anything
> were stored there.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Steven Price <steven.price@arm.com>
If you fancy a bit more clean-up then I think faulty_slots is completely
redundant as a separate variable. In particular in the "if
(suspended_slots)" section it's updated but that updated value is never
used... otherwise I'll put it on my list for cleaning up later.
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index d4bc652b34d5..b3a51a6de523 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -2546,7 +2546,7 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
> {
> struct panthor_scheduler *sched = ptdev->scheduler;
> struct panthor_csg_slots_upd_ctx upd_ctx;
> - u64 suspended_slots, faulty_slots;
> + u32 suspended_slots, faulty_slots;
> struct panthor_group *group;
> u32 i;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: clean up some types in panthor_sched_suspend()
2024-04-08 12:27 ` Steven Price
@ 2024-04-17 9:29 ` Boris Brezillon
0 siblings, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2024-04-17 9:29 UTC (permalink / raw
To: Steven Price
Cc: Dan Carpenter, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter, dri-devel,
linux-kernel, kernel-janitors
On Mon, 8 Apr 2024 13:27:17 +0100
Steven Price <steven.price@arm.com> wrote:
> On 08/04/2024 08:36, Dan Carpenter wrote:
> > These variables should be u32 instead of u64 because they're only
> > storing u32 values. Also static checkers complain when we do:
> >
> > suspended_slots &= ~upd_ctx.timedout_mask;
> >
> > In this code "suspended_slots" is a u64 and "upd_ctx.timedout_mask". The
'and "upd_ctx.timedout_mask" an u32.'?
> > mask clears out the top 32 bits which would likely be a bug if anything
> > were stored there.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>
> Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>
> If you fancy a bit more clean-up then I think faulty_slots is completely
> redundant as a separate variable. In particular in the "if
> (suspended_slots)" section it's updated but that updated value is never
> used... otherwise I'll put it on my list for cleaning up later.
Yeah, I think this variable predates the upd_ctx stuff and is now useless.
I you post such a patch, please add my R-b directly.
Thanks,
Boris
>
> > ---
> > drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> > index d4bc652b34d5..b3a51a6de523 100644
> > --- a/drivers/gpu/drm/panthor/panthor_sched.c
> > +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> > @@ -2546,7 +2546,7 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
> > {
> > struct panthor_scheduler *sched = ptdev->scheduler;
> > struct panthor_csg_slots_upd_ctx upd_ctx;
> > - u64 suspended_slots, faulty_slots;
> > + u32 suspended_slots, faulty_slots;
> > struct panthor_group *group;
> > u32 i;
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-17 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 7:36 [PATCH] drm/panthor: clean up some types in panthor_sched_suspend() Dan Carpenter
2024-04-08 12:27 ` Steven Price
2024-04-17 9:29 ` Boris Brezillon
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).