mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] drm/vc4: unlock on error in vc4_hvs_get_fifo_frame_count()
@ 2024-12-12 11:31 Dan Carpenter
  2024-12-12 11:54 ` Dave Stevenson
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-12-12 11:31 UTC (permalink / raw)
  To: Dave Stevenson
  Cc: Maxime Ripard, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, kernel-janitors

Presumably the default path is never used.  However, if it were used for
some reason then call drm_dev_exit() before returning.

Fixes: 8f2fc64773be ("drm/vc4: Fix reading of frame count on GEN5 / Pi4")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/vc4/vc4_hvs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index b42027636c71..4f524ec126e7 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -522,7 +522,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo)
 		break;
 	default:
 		drm_err(drm, "Unknown VC4 generation: %d", vc4->gen);
-		return 0;
+		field = 0;
 	}
 
 	drm_dev_exit(idx);
-- 
2.45.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] drm/vc4: unlock on error in vc4_hvs_get_fifo_frame_count()
  2024-12-12 11:31 [PATCH next] drm/vc4: unlock on error in vc4_hvs_get_fifo_frame_count() Dan Carpenter
@ 2024-12-12 11:54 ` Dave Stevenson
  2024-12-12 12:45   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Stevenson @ 2024-12-12 11:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Maxime Ripard, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, kernel-janitors

Hi Dan

Thanks for the patch.

On Thu, 12 Dec 2024 at 11:31, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Presumably the default path is never used.  However, if it were used for
> some reason then call drm_dev_exit() before returning.

Correct - the default path would mean something badly wrong.
Without it though, if you add an extra enum value it throws a compiler
warning of an unhandled case.

> Fixes: 8f2fc64773be ("drm/vc4: Fix reading of frame count on GEN5 / Pi4")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/gpu/drm/vc4/vc4_hvs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
> index b42027636c71..4f524ec126e7 100644
> --- a/drivers/gpu/drm/vc4/vc4_hvs.c
> +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
> @@ -522,7 +522,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo)
>                 break;
>         default:
>                 drm_err(drm, "Unknown VC4 generation: %d", vc4->gen);
> -               return 0;
> +               field = 0;

field is initialised to 0 anyway to handle the cases where fifo is out of range.

Personally I'd like to see a break in there to ensure we don't
accidentally end up with a fall-through situation if another case got
added at the end. I don't know how others feel.

  Dave

>         }
>
>         drm_dev_exit(idx);
> --
> 2.45.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] drm/vc4: unlock on error in vc4_hvs_get_fifo_frame_count()
  2024-12-12 11:54 ` Dave Stevenson
@ 2024-12-12 12:45   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-12-12 12:45 UTC (permalink / raw)
  To: Dave Stevenson
  Cc: Maxime Ripard, Maíra Canal, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, kernel-janitors

On Thu, Dec 12, 2024 at 11:54:28AM +0000, Dave Stevenson wrote:
> I don't know how others feel.

These days we have "warning: this statement may fall through
[-Wimplicit-fallthrough=]" which triggers a build failure so fallthrough
bugs are pretty rare.

But I only care about *your* opinion, Dave.  Everyone else can bounce.

I'll send a v2 which adds the break.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12 11:31 [PATCH next] drm/vc4: unlock on error in vc4_hvs_get_fifo_frame_count() Dan Carpenter
2024-12-12 11:54 ` Dave Stevenson
2024-12-12 12:45   ` Dan Carpenter

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®