media: rcar-vin: Do not try to stop stream if not running
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 15 Jan 2021 00:21:45 +0000 (01:21 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 27 Jan 2021 13:16:30 +0000 (14:16 +0100)
Do not attempt to stop the streaming if the stream is not running.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/rcar-vin/rcar-dma.c

index 48280ddb15b9b0eef0b7619a6a34e64f46c868a4..f30dafbdf61ca15fe32447fda5b6050e0bd70044 100644 (file)
@@ -1301,6 +1301,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;
+       }
+
        vin->state = STOPPING;
 
        /* Wait until only scratch buffer is used, max 3 interrupts. */