diff options
-rw-r--r-- | drivers/mtd/ubi/build.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 2c3269ea133d..1405b556c65a 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -380,7 +380,7 @@ static void free_user_volumes(struct ubi_device *ubi) | |||
380 | * @ubi: UBI device description object | 380 | * @ubi: UBI device description object |
381 | * | 381 | * |
382 | * This function returns zero in case of success and a negative error code in | 382 | * This function returns zero in case of success and a negative error code in |
383 | * case of failure. Note, this function destroys all volumes if it failes. | 383 | * case of failure. Note, this function destroys all volumes if it fails. |
384 | */ | 384 | */ |
385 | static int uif_init(struct ubi_device *ubi) | 385 | static int uif_init(struct ubi_device *ubi) |
386 | { | 386 | { |
@@ -871,9 +871,15 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) | |||
871 | ubi->beb_rsvd_pebs); | 871 | ubi->beb_rsvd_pebs); |
872 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); | 872 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); |
873 | 873 | ||
874 | /* | ||
875 | * The below lock makes sure we do not race with 'ubi_thread()' which | ||
876 | * checks @ubi->thread_enabled. Otherwise we may fail to wake it up. | ||
877 | */ | ||
878 | spin_lock(&ubi->wl_lock); | ||
874 | if (!DBG_DISABLE_BGT) | 879 | if (!DBG_DISABLE_BGT) |
875 | ubi->thread_enabled = 1; | 880 | ubi->thread_enabled = 1; |
876 | wake_up_process(ubi->bgt_thread); | 881 | wake_up_process(ubi->bgt_thread); |
882 | spin_unlock(&ubi->wl_lock); | ||
877 | 883 | ||
878 | ubi_devices[ubi_num] = ubi; | 884 | ubi_devices[ubi_num] = ubi; |
879 | return ubi_num; | 885 | return ubi_num; |