summaryrefslogtreecommitdiff
path: root/drivers/mtd/sm_ftl.c
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-02-26 23:08:40 +0300
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 23:13:49 +0300
commit133fa8c7d70d16b07db3a3d87ea18291db8f8ebf (patch)
tree0a5a8ab311a46dbfd8cb3f90dce98adafc6c8473 /drivers/mtd/sm_ftl.c
parent67e054e919248fa1db93de727fb9ad49eb700642 (diff)
downloadlinux-133fa8c7d70d16b07db3a3d87ea18291db8f8ebf.tar.xz
mtd: Few follow up cleanups for Smartmedia/xD support
* Test results of few functions that were declared with __must_check * Fix bogus gcc warning about uinitialized variable 'ret' * Remove unused variable from mtdblock_remove_dev * Don't use deprecated DMA_32BIT_MASK Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/sm_ftl.c')
-rw-r--r--drivers/mtd/sm_ftl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index a59ebb48cae1..9fb56c76ae89 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -228,7 +228,7 @@ static int sm_read_sector(struct sm_ftl *ftl,
struct mtd_info *mtd = ftl->trans->mtd;
struct mtd_oob_ops ops;
struct sm_oob tmp_oob;
- int ret;
+ int ret = -EIO;
int try = 0;
/* FTL can contain -1 entries that are by default filled with bits */
@@ -753,6 +753,7 @@ static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
uint16_t block;
int lba;
int i = 0;
+ int len;
dbg("initializing zone %d", zone_num);
@@ -856,7 +857,9 @@ static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
i %= (kfifo_len(&zone->free_sectors) / 2);
while (i--) {
- kfifo_out(&zone->free_sectors, (unsigned char *)&block, 2);
+ len = kfifo_out(&zone->free_sectors,
+ (unsigned char *)&block, 2);
+ WARN_ON(len != 2);
kfifo_in(&zone->free_sectors, (const unsigned char *)&block, 2);
}
return 0;
@@ -947,17 +950,17 @@ restart:
if (ftl->unstable)
return -EIO;
- /* No spare blocks */
- /* We could still continue by erasing the current block,
+
+ /* If there are no spare blocks, */
+ /* we could still continue by erasing/writing the current block,
but for such worn out media it doesn't worth the trouble,
and the dangers */
-
- if (!kfifo_len(&zone->free_sectors)) {
+ if (kfifo_out(&zone->free_sectors,
+ (unsigned char *)&write_sector, 2) != 2) {
dbg("no free sectors for write!");
return -EIO;
}
- kfifo_out(&zone->free_sectors, (unsigned char *)&write_sector, 2);
if (sm_write_block(ftl, ftl->cache_data, zone_num, write_sector,
ftl->cache_block, ftl->cache_data_invalid_bitmap))