Staging: gdm72xx: Use list_first_entry_or_null
PATCH 1/1 Staging: gdm72xx: Use list_first_entry_or_null
This patch replaces list_empty and list_entry with list_first_entry_or_null as this makes the code more clear. Done using coccinelle:
@@
expression e1,e2;
statement S;
@@
- if(!list_empty(...)){
e2=
- list_entry(e1.next,
+ list_first_entry_or_null(&e1,
...);
+ if(e2){
...
}
Signed-off-by Bhumika Goyal <[email protected]>
--- drivers/staging/gdm72xx/gdm_sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gdm72xx/gdm_sdio.c +2 -2
@@ -551,8 +551,8 @@ end_io:spin_lock_irqsave (&rx->lock, flags); -if (!list_empty (&rx->req_list)) { - r = list_entry(rx->req_list.next, struct sdio_rx, list); + r = list_first_entry_or_null(&rx->req_list, struct sdio_rx, list); +if (r) {spin_unlock_irqrestore (&rx->lock, flags);if (r->callback) r->callback (r->cb_data, rx->rx_buf, len);
Signature · 1 line
1.9.1