mtd: do not duplicate length and offset checks in drivers