2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00
linux-next/drivers/media/usb/tm6000
Julia Lawall 3c9c3902e3 tm6000: drop unnecessary list_empty
list_for_each_entry is able to handle an empty list.
The only effect of avoiding the loop is not initializing the
index variable.
Drop list_empty tests in cases where these variables are not
used.

Note that list_for_each_entry is defined in terms of list_first_entry,
which indicates that it should not be used on an empty list.  But in
list_for_each_entry, the element obtained by list_first_entry is not
really accessed, only the address of its list_head field is compared
to the address of the list head, so the list_first_entry is safe.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@
expression x,e;
iterator name list_for_each_entry;
statement S;
identifier i;
@@

-if (!(list_empty(x))) {
   list_for_each_entry(i,x,...) S
- }
 ... when != i
? i = e
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-09-01 14:12:36 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
tm6000-alsa.c media: Use fallthrough pseudo-keyword 2020-08-29 08:35:27 +02:00
tm6000-cards.c media: Fix various misspellings of disconnected 2019-08-19 12:02:28 -03:00
tm6000-core.c tm6000: drop unnecessary list_empty 2020-09-01 14:12:36 +02:00
tm6000-dvb.c media: tm6000: double free if usb disconnect while streaming 2019-08-14 05:07:39 -03:00
tm6000-i2c.c media: usb: fix several typos 2019-03-01 09:43:27 -05:00
tm6000-input.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 286 2019-06-05 17:36:37 +02:00
tm6000-regs.h media: usb: tm6000: Use the correct style for SPDX License Identifier 2019-10-07 07:45:38 -03:00
tm6000-stds.c media: usb: fix several typos 2019-03-01 09:43:27 -05:00
tm6000-usb-isoc.h media: usb: tm6000: Use the correct style for SPDX License Identifier 2019-10-07 07:45:38 -03:00
tm6000-video.c media: media/usb: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:16 +01:00
tm6000.h media: usb: tm6000: Use the correct style for SPDX License Identifier 2019-10-07 07:45:38 -03:00