mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Songjun Wu <songjun.wu@microchip.com>, nicolas.ferre@atmel.com
Cc: linux-arm-kernel@lists.infradead.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Date: Tue, 1 Nov 2016 09:52:13 +0100	[thread overview]
Message-ID: <c90098d4-4d53-d2e1-2d3e-e38e7d548f45@xs4all.nl> (raw)
In-Reply-To: <1477987726-4257-1-git-send-email-songjun.wu@microchip.com>

On 01/11/16 09:08, Songjun Wu wrote:
> Release the filehandle in 'isc_open' if it's not the only filehandle
> opened for the associated video_device.

What's wrong with that? You should always be able to open the device
multiple times. v4l2-compliance will fail after this patch. I'm not sure
what you intended to do here, but this patch is wrong.

Regards,

	Hans

>
> Signed-off-by: Songjun Wu <songjun.wu@microchip.com>
> ---
>
>  drivers/media/platform/atmel/atmel-isc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
> index 8e25d3f..5e08404 100644
> --- a/drivers/media/platform/atmel/atmel-isc.c
> +++ b/drivers/media/platform/atmel/atmel-isc.c
> @@ -926,21 +926,21 @@ static int isc_open(struct file *file)
>  	if (ret < 0)
>  		goto unlock;
>
> -	if (!v4l2_fh_is_singular_file(file))
> -		goto unlock;
> +	ret = !v4l2_fh_is_singular_file(file);
> +	if (ret)
> +		goto fh_rel;
>
>  	ret = v4l2_subdev_call(sd, core, s_power, 1);
> -	if (ret < 0 && ret != -ENOIOCTLCMD) {
> -		v4l2_fh_release(file);
> -		goto unlock;
> -	}
> +	if (ret < 0 && ret != -ENOIOCTLCMD)
> +		goto fh_rel;
>
>  	ret = isc_set_fmt(isc, &isc->fmt);
> -	if (ret) {
> +	if (ret)
>  		v4l2_subdev_call(sd, core, s_power, 0);
> -		v4l2_fh_release(file);
> -	}
>
> +fh_rel:
> +	if (ret)
> +		v4l2_fh_release(file);
>  unlock:
>  	mutex_unlock(&isc->lock);
>  	return ret;
>

  reply	other threads:[~2016-11-01  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01  8:08 Songjun Wu
2016-11-01  8:52 ` Hans Verkuil [this message]
2016-11-01  9:02   ` Wu, Songjun

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=c90098d4-4d53-d2e1-2d3e-e38e7d548f45@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=songjun.wu@microchip.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®