Skip to content

Commit 894aef2

Browse files
richardweinbergerdedekind
authored andcommitted
UBI: dont call ubi_self_check_all_ff() in __wl_get_peb()
As ubi_self_check_all_ff() might sleep we are not allowed to call it from atomic context. For now we call it only from ubi_wl_get_peb(). There are some code paths where it would also make sense, but these paths are currently atomic and only enabled when fastmap is used. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent ed4b702 commit 894aef2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/mtd/ubi/wl.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor)
498498
* @ubi: UBI device description object
499499
*
500500
* This function returns a physical eraseblock in case of success and a
501-
* negative error code in case of failure. Might sleep.
501+
* negative error code in case of failure.
502502
*/
503503
static int __wl_get_peb(struct ubi_device *ubi)
504504
{
@@ -540,13 +540,6 @@ static int __wl_get_peb(struct ubi_device *ubi)
540540
* ubi_wl_get_peb() after removing e from the pool. */
541541
prot_queue_add(ubi, e);
542542
#endif
543-
err = ubi_self_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset,
544-
ubi->peb_size - ubi->vid_hdr_aloffset);
545-
if (err) {
546-
ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum);
547-
return err;
548-
}
549-
550543
return e->pnum;
551544
}
552545

@@ -690,12 +683,19 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
690683

691684
int ubi_wl_get_peb(struct ubi_device *ubi)
692685
{
693-
int peb;
686+
int peb, err;
694687

695688
spin_lock(&ubi->wl_lock);
696689
peb = __wl_get_peb(ubi);
697690
spin_unlock(&ubi->wl_lock);
698691

692+
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
693+
ubi->peb_size - ubi->vid_hdr_aloffset);
694+
if (err) {
695+
ubi_err("new PEB %d does not contain all 0xFF bytes", peb);
696+
return err;
697+
}
698+
699699
return peb;
700700
}
701701
#endif

0 commit comments

Comments
 (0)