From: Stefan Klug <stefan.klug@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
Dafna Hirschfeld <dafna@fastmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] media: rkisp1: Cleanup error handling
Date: Thu, 22 May 2025 18:30:25 +0200 [thread overview]
Message-ID: <174793142530.244022.2578213319638259858@localhost> (raw)
In-Reply-To: <20250522154210.GT12514@pendragon.ideasonboard.com>
Hi Laurent,
Thank you for the review.
Quoting Laurent Pinchart (2025-05-22 17:42:10)
> Hi Stefan,
>
> Thank you for the patch.
>
> On Thu, May 22, 2025 at 05:08:38PM +0200, Stefan Klug wrote:
> > Do not call media_entity_cleanup() when media_entity_pads_init() fails.
>
> Why is it an issue ? The media_entity_cleanup() documentation clearly
> states
>
> * Calling media_entity_cleanup() on a media_entity whose memory has been
> * zeroed but that has not been initialized with media_entity_pad_init() is
> * valid and is a no-op.
>
> This is by design to simplify error handling in drivers.
Oops. It was simple mechanical thing. I'll remove it in v2.
Regrads,
Stefan
>
> > As a drive-by fix handle an (very unlikely) error in
> > rkisp1_params_init_vb2_queue().
> >
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > ---
> > .../media/platform/rockchip/rkisp1/rkisp1-params.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > index b28f4140c8a3..918eb06c7465 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
> > @@ -2763,7 +2763,9 @@ int rkisp1_params_register(struct rkisp1_device *rkisp1)
> > vdev->queue = &node->buf_queue;
> > vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT;
> > vdev->vfl_dir = VFL_DIR_TX;
> > - rkisp1_params_init_vb2_queue(vdev->queue, params);
> > + ret = rkisp1_params_init_vb2_queue(vdev->queue, params);
> > + if (ret)
> > + goto err_mutex;
> >
> > params->metafmt = &rkisp1_params_formats[RKISP1_PARAMS_FIXED];
> >
> > @@ -2777,19 +2779,20 @@ int rkisp1_params_register(struct rkisp1_device *rkisp1)
> > node->pad.flags = MEDIA_PAD_FL_SOURCE;
> > ret = media_entity_pads_init(&vdev->entity, 1, &node->pad);
> > if (ret)
> > - goto error;
> > + goto err_mutex;
> >
> > ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
> > if (ret) {
> > dev_err(rkisp1->dev,
> > "failed to register %s, ret=%d\n", vdev->name, ret);
> > - goto error;
> > + goto err_media;
> > }
> >
> > return 0;
> >
> > -error:
> > +err_media:
> > media_entity_cleanup(&vdev->entity);
> > +err_mutex:
> > mutex_destroy(&node->vlock);
> > return ret;
> > }
>
> --
> Regards,
>
> Laurent Pinchart
>
next prev parent reply other threads:[~2025-05-22 16:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250522150944.400046-2-stefan.klug@ideasonboard.com>
2025-05-22 15:08 ` [PATCH 1/3] media: rkisp1: Cleanup error handling Stefan Klug
2025-05-22 15:42 ` Laurent Pinchart
2025-05-22 16:30 ` Stefan Klug [this message]
2025-05-22 15:08 ` [PATCH 2/3] media: rkisp1: Add RKISP1_CID_SUPPORTED_PARAMS_BLOCKS control Stefan Klug
2025-05-22 15:56 ` Laurent Pinchart
2025-05-22 16:36 ` Stefan Klug
2025-05-22 16:41 ` Laurent Pinchart
2025-05-22 17:10 ` Stefan Klug
2025-05-22 21:30 ` Laurent Pinchart
2025-05-23 2:19 ` Paul Elder
2025-05-22 15:08 ` [PATCH 3/3] media: rockchip: rkisp1: Add support for Wide Dynamic Range Stefan Klug
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=174793142530.244022.2578213319638259858@localhost \
--to=stefan.klug@ideasonboard.com \
--cc=dafna@fastmail.com \
--cc=heiko@sntech.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).