media: rp1: cfe: Fix error paths in cfe_start_streaming
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 21 Dec 2023 17:59:15 +0000 (17:59 +0000)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:35:26 +0000 (11:35 +0000)
Noted that if we get "node link is not enabled", then we also
get the videobuf2 splat for the driver not cleaning up correctly
on a failed start_streaming, and indeed we weren't returning the
buffers.

Checking the other error paths, noted that the "FE enabled, but
FE_CONFIG node is not" path was not calling pm_runtime_put.

Fix both paths.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/media/platform/raspberrypi/rp1_cfe/cfe.c

index 86d4338..c16199b 100644 (file)
@@ -1112,7 +1112,8 @@ static int cfe_start_streaming(struct vb2_queue *vq, unsigned int count)
        if (!check_state(cfe, NODE_ENABLED, node->id)) {
                cfe_err("%s node link is not enabled.\n",
                        node_desc[node->id].name);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_streaming;
        }
 
        ret = pm_runtime_resume_and_get(&cfe->pdev->dev);
@@ -1126,7 +1127,7 @@ static int cfe_start_streaming(struct vb2_queue *vq, unsigned int count)
            !check_state(cfe, NODE_ENABLED, cfe->node[FE_CONFIG].id)) {
                cfe_err("FE enabled, but FE_CONFIG node is not\n");
                ret = -EINVAL;
-               goto err_streaming;
+               goto err_pm_put;
        }
 
        ret = media_pipeline_start(&node->pad, &cfe->pipe);