* [PATCH 1/2] media: cedrus: Fix missing cleanup in error path
@ 2026-04-01 19:14 Andrey Skvortsov
2026-04-01 19:14 ` [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure Andrey Skvortsov
2026-04-02 13:09 ` [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Dan Carpenter
0 siblings, 2 replies; 6+ messages in thread
From: Andrey Skvortsov @ 2026-04-01 19:14 UTC (permalink / raw)
To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
Cc: Andrey Skvortsov
From: Samuel Holland <samuel@sholland.org>
From: Samuel Holland <samuel@sholland.org>
According to the documentation struct v4l2_fh has to be cleaned up with
v4l2_fh_exit() before being freed. [1]
1. https://docs.kernel.org/driver-api/media/v4l2-fh.html
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
---
drivers/staging/media/sunxi/cedrus/cedrus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index 6600245dff0e2..1d2130f35fffc 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -391,6 +391,7 @@ static int cedrus_open(struct file *file)
err_m2m_release:
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
err_free:
+ v4l2_fh_exit(&ctx->fh);
kfree(ctx);
mutex_unlock(&dev->dev_mutex);
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure
2026-04-01 19:14 [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Andrey Skvortsov
@ 2026-04-01 19:14 ` Andrey Skvortsov
2026-04-02 13:00 ` Dan Carpenter
2026-04-02 13:09 ` [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Dan Carpenter
1 sibling, 1 reply; 6+ messages in thread
From: Andrey Skvortsov @ 2026-04-01 19:14 UTC (permalink / raw)
To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
Cc: Andrey Skvortsov
From: Samuel Holland <samuel@sholland.org>
From: Samuel Holland <samuel@sholland.org>
cedrus_hw_remove undoes, that was done by cedrus_hw_probe previously,
like disabling runtime power management, releasing claimed sram.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
---
drivers/staging/media/sunxi/cedrus/cedrus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index 1d2130f35fffc..ee0e286add67d 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -477,7 +477,7 @@ static int cedrus_probe(struct platform_device *pdev)
ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register V4L2 device\n");
- return ret;
+ goto err_hw;
}
vfd = &dev->vfd;
@@ -538,6 +538,8 @@ static int cedrus_probe(struct platform_device *pdev)
v4l2_m2m_release(dev->m2m_dev);
err_v4l2:
v4l2_device_unregister(&dev->v4l2_dev);
+err_hw:
+ cedrus_hw_remove(dev);
return ret;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure
2026-04-01 19:14 ` [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure Andrey Skvortsov
@ 2026-04-02 13:00 ` Dan Carpenter
2026-04-06 21:31 ` Andrey Skvortsov
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2026-04-02 13:00 UTC (permalink / raw)
To: Andrey Skvortsov
Cc: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
On Wed, Apr 01, 2026 at 10:14:41PM +0300, Andrey Skvortsov wrote:
> From: Samuel Holland <samuel@sholland.org>
>
> From: Samuel Holland <samuel@sholland.org>
>
git am isn't set up to deal with two From: headers.
> cedrus_hw_remove undoes, that was done by cedrus_hw_probe previously,
> like disabling runtime power management, releasing claimed sram.
The first part of this sentence is missing.
Otherwise, the patch itself looks okay.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: cedrus: Fix missing cleanup in error path
2026-04-01 19:14 [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Andrey Skvortsov
2026-04-01 19:14 ` [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure Andrey Skvortsov
@ 2026-04-02 13:09 ` Dan Carpenter
2026-04-06 21:23 ` Andrey Skvortsov
1 sibling, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2026-04-02 13:09 UTC (permalink / raw)
To: Andrey Skvortsov
Cc: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
On Wed, Apr 01, 2026 at 10:14:40PM +0300, Andrey Skvortsov wrote:
> From: Samuel Holland <samuel@sholland.org>
>
> From: Samuel Holland <samuel@sholland.org>
>
> According to the documentation struct v4l2_fh has to be cleaned up with
> v4l2_fh_exit() before being freed. [1]
>
> 1. https://docs.kernel.org/driver-api/media/v4l2-fh.html
>
I wish the commit message would say what the use visible effect of the
bug is. I looked at it and I don't think this patch hurts but I also
didn't necessarily see a that the original code had a user visible bug.
I read the documentation but it wasn't as unambiguous as I'd prefer.
But I'm not a subsystem expert.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: cedrus: Fix missing cleanup in error path
2026-04-02 13:09 ` [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Dan Carpenter
@ 2026-04-06 21:23 ` Andrey Skvortsov
0 siblings, 0 replies; 6+ messages in thread
From: Andrey Skvortsov @ 2026-04-06 21:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
Hi,
On 26-04-02 16:09, Dan Carpenter wrote:
> On Wed, Apr 01, 2026 at 10:14:40PM +0300, Andrey Skvortsov wrote:
> > From: Samuel Holland <samuel@sholland.org>
> >
> > From: Samuel Holland <samuel@sholland.org>
> >
> > According to the documentation struct v4l2_fh has to be cleaned up with
> > v4l2_fh_exit() before being freed. [1]
> >
> > 1. https://docs.kernel.org/driver-api/media/v4l2-fh.html
> >
>
> I wish the commit message would say what the use visible effect of the
> bug is. I looked at it and I don't think this patch hurts but I also
> didn't necessarily see a that the original code had a user visible bug.
>
> I read the documentation but it wasn't as unambiguous as I'd prefer.
>
Thank you for the review. Currently there is no visible
bug. v4l2_fh_exit() in this case only destroys mutex.
But it may change in the future, when v4l2_fh_init/v4l2_fh_exit will
be changed. I think the change maybe useful in this regard.
I'll describe this in the commit message in v2 and resend it separately from the
patch 2, that fixes actual problem. So this change may be skipped, if
maintainers think it's not worth to apply.
--
Best regards,
Andrey Skvortsov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure
2026-04-02 13:00 ` Dan Carpenter
@ 2026-04-06 21:31 ` Andrey Skvortsov
0 siblings, 0 replies; 6+ messages in thread
From: Andrey Skvortsov @ 2026-04-06 21:31 UTC (permalink / raw)
To: Dan Carpenter
Cc: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hans Verkuil, linux-media, linux-staging, linux-arm-kernel,
linux-sunxi, linux-kernel
On 26-04-02 16:00, Dan Carpenter wrote:
> On Wed, Apr 01, 2026 at 10:14:41PM +0300, Andrey Skvortsov wrote:
> > From: Samuel Holland <samuel@sholland.org>
> >
> > From: Samuel Holland <samuel@sholland.org>
> >
>
> git am isn't set up to deal with two From: headers.
Sorry about that. The first line I've added manually and the second
was added by git send-email. I'll fix that in v2.
>
> > cedrus_hw_remove undoes, that was done by cedrus_hw_probe previously,
> > like disabling runtime power management, releasing claimed sram.
>
> The first part of this sentence is missing.
Thanks, I rewrite this part of the commit message.
--
Best regards,
Andrey Skvortsov
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-06 21:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 19:14 [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Andrey Skvortsov
2026-04-01 19:14 ` [PATCH 2/2] media: cedrus: Fix failure to clean up hardware on probe failure Andrey Skvortsov
2026-04-02 13:00 ` Dan Carpenter
2026-04-06 21:31 ` Andrey Skvortsov
2026-04-02 13:09 ` [PATCH 1/2] media: cedrus: Fix missing cleanup in error path Dan Carpenter
2026-04-06 21:23 ` Andrey Skvortsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox