diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c index 7965bb0dae..828924418d 100644 --- a/drivers/mtd/smart.c +++ b/drivers/mtd/smart.c @@ -924,14 +924,9 @@ static int smart_geometry(FAR struct inode *inode, struct geometry *geometry) geometry->geo_writeenabled = false; #endif - erasesize = dev->geo.erasesize; - if (erasesize == 0) - { - erasesize = 262144; - } - + erasesize = dev->geo.erasesize; geometry->geo_nsectors = dev->geo.neraseblocks * erasesize / - dev->sectorsize; + dev->sectorsize; geometry->geo_sectorsize = dev->sectorsize; fvdbg("available: true mediachanged: false writeenabled: %s\n", @@ -971,21 +966,12 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) return OK; } - erasesize = dev->geo.erasesize; - dev->neraseblocks = dev->geo.neraseblocks; - - /* Most FLASH devices have erase size of 64K, but geo.erasesize is only - * 16 bits, so it will be zero - */ - - if (erasesize == 0) - { - erasesize = 262144; - } - - dev->erasesize = erasesize; - dev->sectorsize = size; + erasesize = dev->geo.erasesize; + dev->neraseblocks = dev->geo.neraseblocks; + dev->erasesize = erasesize; + dev->sectorsize = size; dev->mtdBlksPerSector = dev->sectorsize / dev->geo.blocksize; + if (erasesize / dev->sectorsize > 256) { /* We can't throw a dbg message here becasue it is too early. @@ -2812,14 +2798,7 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long a if (dev->erasesize == 0) { - if (dev->geo.erasesize == 0) - { - dev->erasesize = 262144; - } - else - { - dev->erasesize = dev->geo.erasesize; - } + dev->erasesize = dev->geo.erasesize; dbg("ERROR: Invalid geometery ... Sectors per erase block must be 256 or less\n"); dbg(" Erase block size = %d\n", dev->erasesize);