On Wed May 27 11:31:06 2026 +0300, Sakari Ailus wrote:
> If obtaining a firmware message or requesting to queue a buffer list
> failed, either the buffer list or the firmware message buffer wasn't
> properly released. While this is unlikely to happen, return the remaining
> resources now.
> 
> This may still leave buffers queued.
> 
> Signed-off-by: Sakari Ailus <[email protected]>
> Reviewed-by: Antti Laakso <[email protected]>

Patch committed.

Thanks,
Sakari Ailus

 drivers/media/pci/intel/ipu6/ipu6-isys-queue.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

---

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c 
b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
index 38db162d64ca..572663451a5f 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
@@ -242,6 +242,7 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video 
*av,
        struct ipu6_isys_stream *stream = av->stream;
        struct device *dev = &adev->auxdev.dev;
        struct ipu6_isys_buffer_list __bl;
+       struct isys_fw_msgs *msg;
        int ret;
 
        guard(mutex)(&stream->isys->stream_mutex);
@@ -254,26 +255,26 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video 
*av,
        bl = &__bl;
 
        do {
-               struct isys_fw_msgs *msg;
-
                ret = buffer_list_get(stream, bl);
                if (ret < 0)
-                       break;
+                       return 0;
 
                msg = ipu6_get_fw_msg_buf(stream);
-               if (!msg)
-                       return -ENOMEM;
+               if (WARN_ON(!msg))
+                       goto out_requeue;
 
                fw_ops->prepare_buf_set(msg, stream, bl);
                fw_ops->dump_frame_buf_set(dev, msg, stream->nr_output_pins);
                ipu6_isys_buffer_list_queue(bl, IPU6_ISYS_BUFFER_LIST_FL_ACTIVE,
                                            0);
-
                ret = fw_ops->stream_capture(stream->isys,
                                             stream->stream_handle, msg);
-       } while (!WARN_ON(ret));
+               if (WARN_ON(ret))
+                       break;
+       } while (true);
 
-       return 0;
+       /* Error handling begins here. */
+       ipu6_put_fw_msg_buf(stream->isys, msg);
 
 out_requeue:
        if (bl && bl->nbufs)
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to