ARM: i.MX: bbu: early exit when partition too small
So far, writing a barebox image exceeding the partition size aborts with
EPERM as truncate isn't implemented:

  ERROR: writing to /dev/flash-boot.barebox failed with Operation
  not permitted
  update failed
  ERROR: fastboot: update barebox: Operation not permitted

This is unfortunate because by the time the truncation fails, erasing
the partition had already occurred. Avoid this by checking prior to the
pwrite_all whether the file to be written is big enough. This is valid
here because barebox update wouldn't be called on a regular file.

While at it, present callers with a more helpful ENOSPC error.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent aba7cdb commit 3d0bbc226abd972df3123594959ec06582671e6a
@Ahmad Fatoum Ahmad Fatoum authored on 22 Aug 2019
Sascha Hauer committed on 30 Aug 2019
Showing 1 changed file
View
arch/arm/mach-imx/imx-bbu-internal.c