cros_ec: Fail if we cannot determine the flash burst size
authorSimon Glass <sjg@chromium.org>
Tue, 6 Nov 2018 22:21:20 +0000 (15:21 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 21 Nov 2018 02:14:22 +0000 (19:14 -0700)
This value is required for flashing to work correctly. Add a check for
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/misc/cros_ec.c

index e0f3dfc98e06b784132a73e1e715b69592b00adf..7daf16499aa65440e41544e0f93f0226640ab91a 100644 (file)
@@ -827,6 +827,9 @@ int cros_ec_flash_write(struct udevice *dev, const uint8_t *data,
        uint32_t end, off;
        int ret;
 
+       if (!burst)
+               return -EINVAL;
+
        /*
         * TODO: round up to the nearest multiple of write size.  Can get away
         * without that on link right now because its write size is 4 bytes.