* [PATCH] UBI: ubi_wl_flush(): Use list_for_each_entry_safe()
@ 2014-07-27 7:35 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2014-07-27 7:35 UTC (permalink / raw)
To: dedekind1
Cc: dwmw2, computersforpeace, linux-mtd, linux-kernel, Richard Weinberger
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>
---
drivers/mtd/ubi/wl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 0f3425d..20f491713 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1718,12 +1718,12 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
vol_id, lnum, ubi->works_count);
while (found) {
- struct ubi_work *wrk;
+ struct ubi_work *wrk, *tmp;
found = 0;
down_read(&ubi->work_sem);
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) &&
(lnum == UBI_ALL || wrk->lnum == lnum)) {
list_del(&wrk->list);
--
2.0.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] UBI: ubi_wl_flush(): Use list_for_each_entry_safe()
@ 2014-07-27 7:35 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2014-07-27 7:35 UTC (permalink / raw)
To: dedekind1
Cc: linux-mtd, computersforpeace, dwmw2, linux-kernel, Richard Weinberger
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>
---
drivers/mtd/ubi/wl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 0f3425d..20f491713 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1718,12 +1718,12 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum)
vol_id, lnum, ubi->works_count);
while (found) {
- struct ubi_work *wrk;
+ struct ubi_work *wrk, *tmp;
found = 0;
down_read(&ubi->work_sem);
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) &&
(lnum == UBI_ALL || wrk->lnum == lnum)) {
list_del(&wrk->list);
--
2.0.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] UBI: ubi_wl_flush(): Use list_for_each_entry_safe()
2014-07-27 7:35 ` Richard Weinberger
@ 2014-07-28 16:08 ` Artem Bityutskiy
-1 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2014-07-28 16:08 UTC (permalink / raw)
To: Richard Weinberger; +Cc: dwmw2, computersforpeace, linux-mtd, linux-kernel
On Sun, 2014-07-27 at 09:35 +0200, Richard Weinberger wrote:
> 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>
Pushed to linux-ubifs.git, thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] UBI: ubi_wl_flush(): Use list_for_each_entry_safe()
@ 2014-07-28 16:08 ` Artem Bityutskiy
0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2014-07-28 16:08 UTC (permalink / raw)
To: Richard Weinberger; +Cc: linux-mtd, computersforpeace, dwmw2, linux-kernel
On Sun, 2014-07-27 at 09:35 +0200, Richard Weinberger wrote:
> 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>
Pushed to linux-ubifs.git, thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-28 16:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 7:35 [PATCH] UBI: ubi_wl_flush(): Use list_for_each_entry_safe() Richard Weinberger
2014-07-27 7:35 ` Richard Weinberger
2014-07-28 16:08 ` Artem Bityutskiy
2014-07-28 16:08 ` Artem Bityutskiy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.