summaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-2.6.38/067-block2mtd_2.6.38_fix.patch
blob: 1a052b3f43a670b40911daa7356464200386c7fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -264,12 +264,13 @@ static int _open_bdev(struct block2mtd_d
 	bdev = blkdev_get_by_path(dev->devname, mode, dev);
 #ifndef MODULE
 	if (IS_ERR(bdev)) {
+		dev_t devt;
 
 		/* We might not have rootfs mounted at this point. Try
 		   to resolve the device name by other means. */
 
 		wait_for_device_probe();
-		dev_t devt = name_to_dev_t(dev->devname);
+		devt = name_to_dev_t(dev->devname);
 		if (devt)
 			bdev = blkdev_get_by_dev(devt, mode, dev);
 	}
@@ -330,7 +331,7 @@ static int block2mtd_refresh(struct mtd_
 	_close_bdev(dev);
 
 	/* open the whole disk, issue a partition rescan, then */
-	bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ);
+	bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ, mtd);
 	if (!bdev || !bdev->bd_disk)
 		err = -EINVAL;
 #ifndef CONFIG_MTD_BLOCK2MTD_MODULE
@@ -395,7 +396,7 @@ static struct block2mtd_dev *add_device(
 	dev->mtd.refresh_device = block2mtd_refresh;
 
 	part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
-	part->name = dev->mtd.name;
+	part->name = name;
 	part->offset = 0;
 	part->size = dev->mtd.size;
 	if (add_mtd_partitions(&dev->mtd, part, 1)) {