diff options
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 880fa3690352..85f50c83cf42 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -1168,6 +1168,15 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
1168 | } | 1168 | } |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | if (ubi->avail_pebs < EBA_RESERVED_PEBS) { | ||
1172 | ubi_err("no enough physical eraseblocks (%d, need %d)", | ||
1173 | ubi->avail_pebs, EBA_RESERVED_PEBS); | ||
1174 | err = -ENOSPC; | ||
1175 | goto out_free; | ||
1176 | } | ||
1177 | ubi->avail_pebs -= EBA_RESERVED_PEBS; | ||
1178 | ubi->rsvd_pebs += EBA_RESERVED_PEBS; | ||
1179 | |||
1171 | if (ubi->bad_allowed) { | 1180 | if (ubi->bad_allowed) { |
1172 | ubi_calculate_reserved(ubi); | 1181 | ubi_calculate_reserved(ubi); |
1173 | 1182 | ||
@@ -1184,15 +1193,6 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
1184 | ubi->rsvd_pebs += ubi->beb_rsvd_pebs; | 1193 | ubi->rsvd_pebs += ubi->beb_rsvd_pebs; |
1185 | } | 1194 | } |
1186 | 1195 | ||
1187 | if (ubi->avail_pebs < EBA_RESERVED_PEBS) { | ||
1188 | ubi_err("no enough physical eraseblocks (%d, need %d)", | ||
1189 | ubi->avail_pebs, EBA_RESERVED_PEBS); | ||
1190 | err = -ENOSPC; | ||
1191 | goto out_free; | ||
1192 | } | ||
1193 | ubi->avail_pebs -= EBA_RESERVED_PEBS; | ||
1194 | ubi->rsvd_pebs += EBA_RESERVED_PEBS; | ||
1195 | |||
1196 | dbg_eba("EBA unit is initialized"); | 1196 | dbg_eba("EBA unit is initialized"); |
1197 | return 0; | 1197 | return 0; |
1198 | 1198 | ||