summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sf_dataflash.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-08-16 18:07:15 -0400
committerTom Rini <trini@konsulko.com>2017-08-16 18:07:15 -0400
commit390194d43fa4478ddb638164ddb114c979f3e57a (patch)
treeb6278052b1fef016ee28f1d8c64f01cb832ee924 /drivers/mtd/spi/sf_dataflash.c
parentc5951991942330c129f3b181e94969d7c01e9abb (diff)
parent294f2050c438d1e4ab39fd040d394927772048f2 (diff)
Merge git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/mtd/spi/sf_dataflash.c')
-rw-r--r--drivers/mtd/spi/sf_dataflash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
index bcddfa0755..e5c0e12faa 100644
--- a/drivers/mtd/spi/sf_dataflash.c
+++ b/drivers/mtd/spi/sf_dataflash.c
@@ -134,11 +134,17 @@ static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)
debug("%s: erase addr=0x%x len 0x%x\n", dev->name, offset, len);
div_u64_rem(len, spi_flash->page_size, &rem);
- if (rem)
+ if (rem) {
+ printf("%s: len(0x%x) isn't the multiple of page size(0x%x)\n",
+ dev->name, len, spi_flash->page_size);
return -EINVAL;
+ }
div_u64_rem(offset, spi_flash->page_size, &rem);
- if (rem)
+ if (rem) {
+ printf("%s: offset(0x%x) isn't the multiple of page size(0x%x)\n",
+ dev->name, offset, spi_flash->page_size);
return -EINVAL;
+ }
status = spi_claim_bus(spi);
if (status) {