Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67990472 authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman
Browse files

USB: mos7720: fix to use list_for_each_entry_safe() when delete items



Since we will be removing items off the list using list_del() we need
to use a safer version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe(). We should use the safe macro if the loop
involves deletions of items.

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 697d5c00
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -281,7 +281,7 @@ static void send_deferred_urbs(unsigned long _mos_parport)
	int ret_val;
	int ret_val;
	unsigned long flags;
	unsigned long flags;
	struct mos7715_parport *mos_parport = (void *)_mos_parport;
	struct mos7715_parport *mos_parport = (void *)_mos_parport;
	struct urbtracker *urbtrack;
	struct urbtracker *urbtrack, *tmp;
	struct list_head *cursor, *next;
	struct list_head *cursor, *next;


	/* if release function ran, game over */
	/* if release function ran, game over */
@@ -312,7 +312,7 @@ static void send_deferred_urbs(unsigned long _mos_parport)
	/* move contents of deferred_urbs list to active_urbs list and submit */
	/* move contents of deferred_urbs list to active_urbs list and submit */
	list_for_each_safe(cursor, next, &mos_parport->deferred_urbs)
	list_for_each_safe(cursor, next, &mos_parport->deferred_urbs)
		list_move_tail(cursor, &mos_parport->active_urbs);
		list_move_tail(cursor, &mos_parport->active_urbs);
	list_for_each_entry(urbtrack, &mos_parport->active_urbs,
	list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs,
			    urblist_entry) {
			    urblist_entry) {
		ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC);
		ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC);
		dbg("%s: urb submitted", __func__);
		dbg("%s: urb submitted", __func__);