]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/mtd/sm_ftl.c
net: dsa: bcm_sf2: Fix driver removal
[linux.git] / drivers / mtd / sm_ftl.c
index dfc47a444b90fc439976955f4486f8994b8aa56e..4744bf94ad9a912f5dd7a0cdd3478c4c27fac853 100644 (file)
@@ -774,8 +774,11 @@ static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
                        continue;
 
                /* Read the oob of first sector */
-               if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob))
+               if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) {
+                       kfifo_free(&zone->free_sectors);
+                       kfree(zone->lba_to_phys_table);
                        return -EIO;
+               }
 
                /* Test to see if block is erased. It is enough to test
                        first sector, because erase happens in one shot */