diff options
author | Sanjana Sanikommu <sanjana99reddy99@gmail.com> | 2019-04-01 19:26:37 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-01 19:28:07 +0200 |
commit | 0d15252370ec4f82d4f8afe828c2671485fc84f5 (patch) | |
tree | 1c9eda4bde4ad225a31f61367a7ecb669868782d /drivers/staging/media/imx/imx-media-capture.c | |
parent | 643cd0a25d5d1605eb3e6b083ef5accaddc616cf (diff) | |
download | linux-0d15252370ec4f82d4f8afe828c2671485fc84f5.tar.gz linux-0d15252370ec4f82d4f8afe828c2671485fc84f5.tar.bz2 linux-0d15252370ec4f82d4f8afe828c2671485fc84f5.zip |
staging: media: imx: Replace list_entry with list_for_each_entry_safe
Challenge suggested by coccinelle.
Replace use of the combination of list_empty() and list_entry() with
list_for_each_entry_safe() to simplify the code.
Issue found using below Coccinelle script.
@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@
T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media/imx/imx-media-capture.c')
-rw-r--r-- | drivers/staging/media/imx/imx-media-capture.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 9703c85b19c4..facce18975d8 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -556,6 +556,7 @@ static void capture_stop_streaming(struct vb2_queue *vq) { struct capture_priv *priv = vb2_get_drv_priv(vq); struct imx_media_buffer *frame; + struct imx_media_buffer *tmp; unsigned long flags; int ret; @@ -570,9 +571,7 @@ static void capture_stop_streaming(struct vb2_queue *vq) /* release all active buffers */ spin_lock_irqsave(&priv->q_lock, flags); - while (!list_empty(&priv->ready_q)) { - frame = list_entry(priv->ready_q.next, - struct imx_media_buffer, list); + list_for_each_entry_safe(frame, tmp, &priv->ready_q, list) { list_del(&frame->list); vb2_buffer_done(&frame->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); } |