diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-08 16:13:28 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:50 -0400 |
commit | 104bb37d3e0eb576b6aa61b9ed909e118e026bd2 (patch) | |
tree | 904391317ad07afccc583b2c161a093c44b8aa60 | |
parent | 342827d7d19cb52b562bb3efeb4d4b672d008c35 (diff) |
gadgetfs: list_for_each_safe() misuse
really weirdly spelled "while the list is non-empty, pick its
first element, remove it from the list and free it" kind of loop...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/usb/gadget/inode.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index c95eea43b63..f701afb349e 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1569,20 +1569,18 @@ delegate: static void destroy_ep_files (struct dev_data *dev) { - struct list_head *entry, *tmp; - DBG (dev, "%s %d\n", __func__, dev->state); /* dev->state must prevent interference */ restart: spin_lock_irq (&dev->lock); - list_for_each_safe (entry, tmp, &dev->epfiles) { + while (!list_empty(&dev->epfiles)) { struct ep_data *ep; struct inode *parent; struct dentry *dentry; /* break link to FS */ - ep = list_entry (entry, struct ep_data, epfiles); + ep = list_first_entry (&dev->epfiles, struct ep_data, epfiles); list_del_init (&ep->epfiles); dentry = ep->dentry; ep->dentry = NULL; @@ -1605,8 +1603,7 @@ restart: dput (dentry); mutex_unlock (&parent->i_mutex); - /* fds may still be open */ - goto restart; + spin_lock_irq (&dev->lock); } spin_unlock_irq (&dev->lock); } |