Use the _safe variant because we're iterating over a list where items get
deleted and freed.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
This commit is contained in:
Richard Weinberger 2014-07-27 09:35:48 +02:00 коммит произвёл Artem Bityutskiy
Родитель 4df38926f3
Коммит 49e236bc4a
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -1718,12 +1718,12 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
vol_id, lnum, ubi->works_count); vol_id, lnum, ubi->works_count);
while (found) { while (found) {
struct ubi_work *wrk; struct ubi_work *wrk, *tmp;
found = 0; found = 0;
down_read(&ubi->work_sem); down_read(&ubi->work_sem);
spin_lock(&ubi->wl_lock); spin_lock(&ubi->wl_lock);
list_for_each_entry(wrk, &ubi->works, list) { list_for_each_entry_safe(wrk, tmp, &ubi->works, list) {
if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) && if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) &&
(lnum == UBI_ALL || wrk->lnum == lnum)) { (lnum == UBI_ALL || wrk->lnum == lnum)) {
list_del(&wrk->list); list_del(&wrk->list);