mtd: Introduce and use iteration macro for reading the MTD device table