UBI: bugfix: allocate mandatory EBs first
UBI: bugfix: allocate mandatory EBs first

First allocate the necessary eraseblocks, then the optional ones.
Otherwise it allocates all PEBs for bad EB handling, and fails
on then following EBA LEB allocation.

Reported-by: Adrian Hunter <07e5499f8ca7b9f9593b4a7656ea8c5a05a8f7f6@nokia.com>
Signed-off-by: Artem Bityutskiy <19b5733dcea388885746d36043d3568bba5b4df7@nokia.com>

KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas