mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jammy Huang <jammy_huang@aspeedtech.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"laurent.pinchart@ideasonboard.com" 
	<laurent.pinchart@ideasonboard.com>,
	"eajames@linux.ibm.com" <eajames@linux.ibm.com>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"andrew@aj.id.au" <andrew@aj.id.au>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] media: aspeed: move err-handling together to the bottom
Date: Wed, 15 Dec 2021 09:59:27 +0800	[thread overview]
Message-ID: <8bc81b12-795e-b7a1-64dd-a15f30c5f19d@aspeedtech.com> (raw)
In-Reply-To: <20211214155300.0132946e@coco.lan>

Hi Mauro,

Because I saw similar error-handling in aspeed_video_init(), I just want 
to make it clear and identical.
It's ok if not applied. Just style problem, as you said.

On 2021/12/14 下午 10:53, Mauro Carvalho Chehab wrote:
> Em Mon, 6 Dec 2021 08:48:11 +0800
> Jammy Huang <jammy_huang@aspeedtech.com> escreveu:
>
>> refine aspeed_video_setup_video() flow.
> Why? It makes no difference where the error handling code is. Let's
> keep it as preferred by the driver's author ;-)
>
> Regards,
> Mauro
>
>> Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
>> ---
>> v2:
>>   - remove change-id in comment
>> ---
>>   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 fea5e4d0927e..f5c40d6b4ece 100644
>> --- a/drivers/media/platform/aspeed-video.c
>> +++ b/drivers/media/platform/aspeed-video.c
>> @@ -1641,11 +1641,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;
>> @@ -1663,11 +1660,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;
>> @@ -1685,15 +1679,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)
>
>
> Thanks,
> Mauro

-- 
Best Regards
Jammy


      parent reply	other threads:[~2021-12-15  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  0:48 Jammy Huang
2021-12-14 14:53 ` Mauro Carvalho Chehab
2021-12-14 18:32   ` Sakari Ailus
2021-12-15  1:59     ` Jammy Huang
2021-12-15  1:59   ` Jammy Huang [this message]

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=8bc81b12-795e-b7a1-64dd-a15f30c5f19d@aspeedtech.com \
    --to=jammy_huang@aspeedtech.com \
    --cc=andrew@aj.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=joel@jms.id.au \
    --cc=laurent.pinchart@ideasonboard.com \
    --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 \
    --cc=sakari.ailus@linux.intel.com \
    /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

all inboxes | Powered by JetHome®