aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-02-26 15:08:40 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 15:13:49 -0500
commit133fa8c7d70d16b07db3a3d87ea18291db8f8ebf (patch)
tree0a5a8ab311a46dbfd8cb3f90dce98adafc6c8473
parent67e054e919248fa1db93de727fb9ad49eb700642 (diff)
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>
-rw-r--r--drivers/mtd/mtd_blkdevs.c6
-rw-r--r--drivers/mtd/mtdblock.c1
-rw-r--r--drivers/mtd/nand/r852.c6
-rw-r--r--drivers/mtd/sm_ftl.c17
4 files changed, 18 insertions, 12 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 9dd23d6acbb6..e32c49cb4005 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -380,9 +380,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
380 380
381 add_disk(gd); 381 add_disk(gd);
382 382
383 if (new->disk_attributes) 383 if (new->disk_attributes) {
384 sysfs_create_group(&disk_to_dev(gd)->kobj, 384 ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
385 new->disk_attributes); 385 new->disk_attributes);
386 WARN_ON(ret);
387 }
386 return 0; 388 return 0;
387error4: 389error4:
388 module_put(tr->owner); 390 module_put(tr->owner);
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index 7ce30a239ada..e6edbec609fd 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -354,7 +354,6 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
354 354
355static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) 355static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev)
356{ 356{
357 struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
358 del_mtd_blktrans_dev(dev); 357 del_mtd_blktrans_dev(dev);
359} 358}
360 359
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 9307a88e5229..7a616a926ee9 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -654,7 +654,9 @@ int r852_register_nand_device(struct r852_device *dev)
654 if (sm_register_device(dev->mtd)) 654 if (sm_register_device(dev->mtd))
655 goto error2; 655 goto error2;
656 656
657 device_create_file(&dev->mtd->dev, &dev_attr_media_type); 657 if (device_create_file(&dev->mtd->dev, &dev_attr_media_type))
658 message("can't create media type sysfs attribute");
659
658 dev->card_registred = 1; 660 dev->card_registred = 1;
659 return 0; 661 return 0;
660error2: 662error2:
@@ -838,7 +840,7 @@ int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
838 840
839 pci_set_master(pci_dev); 841 pci_set_master(pci_dev);
840 842
841 error = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK); 843 error = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32));
842 if (error) 844 if (error)
843 goto error2; 845 goto error2;
844 846
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,
228 struct mtd_info *mtd = ftl->trans->mtd; 228 struct mtd_info *mtd = ftl->trans->mtd;
229 struct mtd_oob_ops ops; 229 struct mtd_oob_ops ops;
230 struct sm_oob tmp_oob; 230 struct sm_oob tmp_oob;
231 int ret; 231 int ret = -EIO;
232 int try = 0; 232 int try = 0;
233 233
234 /* FTL can contain -1 entries that are by default filled with bits */ 234 /* 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)
753 uint16_t block; 753 uint16_t block;
754 int lba; 754 int lba;
755 int i = 0; 755 int i = 0;
756 int len;
756 757
757 dbg("initializing zone %d", zone_num); 758 dbg("initializing zone %d", zone_num);
758 759
@@ -856,7 +857,9 @@ static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
856 i %= (kfifo_len(&zone->free_sectors) / 2); 857 i %= (kfifo_len(&zone->free_sectors) / 2);
857 858
858 while (i--) { 859 while (i--) {
859 kfifo_out(&zone->free_sectors, (unsigned char *)&block, 2); 860 len = kfifo_out(&zone->free_sectors,
861 (unsigned char *)&block, 2);
862 WARN_ON(len != 2);
860 kfifo_in(&zone->free_sectors, (const unsigned char *)&block, 2); 863 kfifo_in(&zone->free_sectors, (const unsigned char *)&block, 2);
861 } 864 }
862 return 0; 865 return 0;
@@ -947,17 +950,17 @@ restart:
947 950
948 if (ftl->unstable) 951 if (ftl->unstable)
949 return -EIO; 952 return -EIO;
950 /* No spare blocks */ 953
951 /* We could still continue by erasing the current block, 954 /* If there are no spare blocks, */
955 /* we could still continue by erasing/writing the current block,
952 but for such worn out media it doesn't worth the trouble, 956 but for such worn out media it doesn't worth the trouble,
953 and the dangers */ 957 and the dangers */
954 958 if (kfifo_out(&zone->free_sectors,
955 if (!kfifo_len(&zone->free_sectors)) { 959 (unsigned char *)&write_sector, 2) != 2) {
956 dbg("no free sectors for write!"); 960 dbg("no free sectors for write!");
957 return -EIO; 961 return -EIO;
958 } 962 }
959 963
960 kfifo_out(&zone->free_sectors, (unsigned char *)&write_sector, 2);
961 964
962 if (sm_write_block(ftl, ftl->cache_data, zone_num, write_sector, 965 if (sm_write_block(ftl, ftl->cache_data, zone_num, write_sector,
963 ftl->cache_block, ftl->cache_data_invalid_bitmap)) 966 ftl->cache_block, ftl->cache_data_invalid_bitmap))