linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 1/4] rcar-vin: Do not try to stop stream if not running
Date: Mon, 16 Nov 2020 17:28:38 +0100	[thread overview]
Message-ID: <20201116162838.opj7nfpvmfvup6cq@uno.localdomain> (raw)
In-Reply-To: <20201112225147.1672622-2-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

On Thu, Nov 12, 2020 at 11:51:44PM +0100, Niklas Söderlund wrote:
> Do not attempt to stop the streaming if the stream is not running.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index 5a5f0e5007478c8d..eae25972ed7df2b6 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -1302,6 +1302,11 @@ void rvin_stop_streaming(struct rvin_dev *vin)
>
>  	spin_lock_irqsave(&vin->qlock, flags);
>
> +	if (vin->state == STOPPED) {
> +		spin_unlock_irqrestore(&vin->qlock, flags);
> +		return;

Do I read it right that, in case a double stop is attempted, returning
here is not enough as the caller:

{
	rvin_stop_streaming(vin);

	/* Free scratch buffer. */
	dma_free_coherent(vin->dev, vin->format.sizeimage, vin->scratch,
			  vin->scratch_phys);

	return_unused_buffers(vin, VB2_BUF_STATE_ERROR);
}

Are the potential double call to dma_free_coherent and the buffer
return procedure harmless ?

Thanks
   j

> +	}
> +
>  	vin->state = STOPPING;
>
>  	/* Wait until only scratch buffer is used, max 3 interrupts. */
> --
> 2.29.2
>

  reply	other threads:[~2020-11-16 16:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 22:51 [PATCH 0/4] rcar-csi2: Update handling of transfer error Niklas Söderlund
2020-11-12 22:51 ` [PATCH 1/4] rcar-vin: Do not try to stop stream if not running Niklas Söderlund
2020-11-16 16:28   ` Jacopo Mondi [this message]
2021-01-15  0:15     ` Niklas Söderlund
2020-11-12 22:51 ` [PATCH 2/4] rcar-vin: Route events to correct video device Niklas Söderlund
2020-11-16 16:54   ` Jacopo Mondi
2020-11-12 22:51 ` [PATCH 3/4] rcar-vin: Stop stream when subdevice signal EOS Niklas Söderlund
2020-11-16 16:58   ` Jacopo Mondi
2021-01-15  0:17     ` Niklas Söderlund
2020-11-12 22:51 ` [PATCH 4/4] rcar-csi2: Do not try to recover after transfer error Niklas Söderlund
2020-11-16 17:09   ` Jacopo Mondi
2021-01-15  0:19     ` Niklas Söderlund

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=20201116162838.opj7nfpvmfvup6cq@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    /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).