From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: media: meson: vdec: Cancel esparser work during teardown Date: Thu, 04 Jun 2026 15:48:46 +1000 Message-ID: In-Reply-To: <20260530094326.11892-6-linux.amoon@gmail.com> References: <20260530094326.11892-1-linux.amoon@gmail.com> <20260530094326.11892-6-linux.amoon@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Good:** Adding `cancel_work_sync()` in teardown paths is the right approa= ch. **Issue =E2=80=94 drain moved before hardware teardown:** ```c cancel_work_sync(&sess->esparser_queue_work); mutex_lock(&core->lock); ... sess->status =3D STATUS_STOPPED; mutex_unlock(&core->lock); if (q->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (old_status >=3D STATUS_RUNNING && codec_ops->drain) codec_ops->drain(sess); } if (old_status =3D=3D STATUS_RUNNING || ...) ... vdec_poweroff(sess); /* also calls drain() internally! */ ``` There are two problems here: 1. `codec_ops->drain()` is now called **before** `vdec_poweroff()`, but `vd= ec_poweroff()` also calls `codec_ops->drain()` internally (line 122-123 of = the original). So drain is called **twice** =E2=80=94 once explicitly here,= and once inside `vdec_poweroff()`. 2. The commit message says "Move codec_ops->drain() evaluation earlier in s= top_streaming() using the status snapshot, so draining occurs before buffer= cleanup." But the original code already drained before buffer cleanup (dra= in was in the `else` branch before `v4l2_m2m_dst_buf_remove()`). The move c= reates the double-drain issue. **Issue =E2=80=94 `cancel_work_sync` in `vdec_close`:** This is fine as def= ense-in-depth, since `v4l2_m2m_ctx_release()` should trigger `stop_streamin= g` which already cancels it (after this patch). --- Generated by Claude Code Patch Reviewer