From: Jammy Huang <jammy_huang@aspeedtech.com>
To: <eajames@linux.ibm.com>, <mchehab@kernel.org>, <joel@jms.id.au>,
<andrew@aj.id.au>, <linux-media@vger.kernel.org>,
<openbmc@lists.ozlabs.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/6] media: aspeed: move err-handling together to the bottom
Date: Thu, 14 Oct 2021 11:48:14 +0800 [thread overview]
Message-ID: <20211014034819.2283-2-jammy_huang@aspeedtech.com> (raw)
In-Reply-To: <20211014034819.2283-1-jammy_huang@aspeedtech.com>
refine aspeed_video_setup_video() flow.
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
---
drivers/media/platform/aspeed-video.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
index 491447bf5186..6259cf17a7cc 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -1644,11 +1644,8 @@ static int aspeed_video_setup_video(struct aspeed_video *video)
rc = video->ctrl_handler.error;
if (rc) {
- v4l2_ctrl_handler_free(&video->ctrl_handler);
- v4l2_device_unregister(v4l2_dev);
-
dev_err(video->dev, "Failed to init controls: %d\n", rc);
- return rc;
+ goto err_ctrl_init;
}
v4l2_dev->ctrl_handler = &video->ctrl_handler;
@@ -1666,11 +1663,8 @@ static int aspeed_video_setup_video(struct aspeed_video *video)
rc = vb2_queue_init(vbq);
if (rc) {
- v4l2_ctrl_handler_free(&video->ctrl_handler);
- v4l2_device_unregister(v4l2_dev);
-
dev_err(video->dev, "Failed to init vb2 queue\n");
- return rc;
+ goto err_vb2_init;
}
vdev->queue = vbq;
@@ -1688,15 +1682,19 @@ static int aspeed_video_setup_video(struct aspeed_video *video)
video_set_drvdata(vdev, video);
rc = video_register_device(vdev, VFL_TYPE_GRABBER, 0);
if (rc) {
- vb2_queue_release(vbq);
- v4l2_ctrl_handler_free(&video->ctrl_handler);
- v4l2_device_unregister(v4l2_dev);
-
dev_err(video->dev, "Failed to register video device\n");
- return rc;
+ goto err_video_reg;
}
return 0;
+
+err_video_reg:
+ vb2_queue_release(vbq);
+err_vb2_init:
+err_ctrl_init:
+ v4l2_ctrl_handler_free(&video->ctrl_handler);
+ v4l2_device_unregister(v4l2_dev);
+ return rc;
}
static int aspeed_video_init(struct aspeed_video *video)
--
2.25.1
next prev parent reply other threads:[~2021-10-14 3:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 3:48 [PATCH 0/6] add aspeed-jpeg support for aspeed-video Jammy Huang
2021-10-14 3:48 ` Jammy Huang [this message]
2021-10-14 3:48 ` [PATCH 2/6] media: aspeed: add dprintk for more detailed log control Jammy Huang
2021-10-14 6:28 ` Paul Menzel
2021-10-15 2:16 ` Jammy Huang
2021-10-15 8:29 ` Paul Menzel
2021-10-14 3:48 ` [PATCH 3/6] media: aspeed: refine to centerize format/compress settings Jammy Huang
2021-10-14 6:36 ` Paul Menzel
2021-10-15 5:39 ` Jammy Huang
2021-10-14 3:48 ` [PATCH 4/6] media: aspeed: Support aspeed mode to reduce compressed data Jammy Huang
2021-10-14 6:47 ` Paul Menzel
2021-10-18 8:51 ` Jammy Huang
2021-10-18 9:34 ` Paul Menzel
2021-10-18 10:10 ` Jammy Huang
2021-10-14 3:48 ` [PATCH 5/6] media: aspeed: add comments and macro Jammy Huang
2021-10-14 3:48 ` [PATCH 6/6] media: aspeed: richer debugfs Jammy Huang
2021-10-14 6:54 ` Paul Menzel
2021-10-14 6:57 ` Paul Menzel
2021-10-15 3:29 ` Jammy Huang
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=20211014034819.2283-2-jammy_huang@aspeedtech.com \
--to=jammy_huang@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=openbmc@lists.ozlabs.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).