From f432eb7ea1428f81d4ebeb1069ea3823e008acd8 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sun, 18 Mar 2018 16:10:14 +0000 Subject: [PATCH] Remove a pointless KASSERT and reword a comment a bit. The KASSERT tested for the same condition that the preceeding lines checked for and would have returned EIO, so the assert could never possibly trigger (sc_sectorsize must inherently be an integer multiple of FLASH_PAGE_SIZE). --- sys/dev/flash/mx25l.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c index db1bc1d6323f..5ca9f0fc4202 100644 --- a/sys/dev/flash/mx25l.c +++ b/sys/dev/flash/mx25l.c @@ -300,20 +300,12 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, off_t count) write_offset = offset; /* - * Use the erase sectorsize here since blocks are fully erased - * first before they're written to. + * Writes must be aligned to the erase sectorsize, since blocks are + * fully erased before they're written to. */ if (count % sc->sc_sectorsize != 0 || offset % sc->sc_sectorsize != 0) return (EIO); - /* - * Assume here that we write per-sector only - * and sector size should be 256 bytes aligned - */ - KASSERT(write_offset % FLASH_PAGE_SIZE == 0, - ("offset for BIO_WRITE is not page size (%d bytes) aligned", - FLASH_PAGE_SIZE)); - /* * Maximum write size for CMD_PAGE_PROGRAM is * FLASH_PAGE_SIZE, so split data to chunks