aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdchar.c16
-rw-r--r--drivers/mtd/nand/tmio_nand.c8
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index d2f331876e4c..e00d424e6575 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -410,16 +410,20 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
410 410
411 case MEMGETREGIONINFO: 411 case MEMGETREGIONINFO:
412 { 412 {
413 struct region_info_user ur; 413 uint32_t ur_idx;
414 struct mtd_erase_region_info *kr;
415 struct region_info_user *ur = (struct region_info_user *) argp;
414 416
415 if (copy_from_user(&ur, argp, sizeof(struct region_info_user))) 417 if (get_user(ur_idx, &(ur->regionindex)))
416 return -EFAULT; 418 return -EFAULT;
417 419
418 if (ur.regionindex >= mtd->numeraseregions) 420 kr = &(mtd->eraseregions[ur_idx]);
419 return -EINVAL; 421
420 if (copy_to_user(argp, &(mtd->eraseregions[ur.regionindex]), 422 if (put_user(kr->offset, &(ur->offset))
421 sizeof(struct mtd_erase_region_info))) 423 || put_user(kr->erasesize, &(ur->erasesize))
424 || put_user(kr->numblocks, &(ur->numblocks)))
422 return -EFAULT; 425 return -EFAULT;
426
423 break; 427 break;
424 } 428 }
425 429
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index cbab654b03c8..edb1e322113d 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -109,7 +109,7 @@ struct tmio_nand {
109 109
110 void __iomem *ccr; 110 void __iomem *ccr;
111 void __iomem *fcr; 111 void __iomem *fcr;
112 unsigned long fcr_phys; 112 unsigned long fcr_base;
113 113
114 unsigned int irq; 114 unsigned int irq;
115 115
@@ -316,8 +316,8 @@ static int tmio_hw_init(struct platform_device *dev, struct tmio_nand *tmio)
316 tmio_iowrite8(0x81, tmio->ccr + CCR_ICC); 316 tmio_iowrite8(0x81, tmio->ccr + CCR_ICC);
317 317
318 /* (10h)BaseAddress 0x1000 spba.spba2 */ 318 /* (10h)BaseAddress 0x1000 spba.spba2 */
319 tmio_iowrite16(tmio->fcr_phys, tmio->ccr + CCR_BASE); 319 tmio_iowrite16(tmio->fcr_base, tmio->ccr + CCR_BASE);
320 tmio_iowrite16(tmio->fcr_phys >> 16, tmio->ccr + CCR_BASE + 16); 320 tmio_iowrite16(tmio->fcr_base >> 16, tmio->ccr + CCR_BASE + 2);
321 321
322 /* (04h)Command Register I/O spcmd */ 322 /* (04h)Command Register I/O spcmd */
323 tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND); 323 tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND);
@@ -395,7 +395,7 @@ static int tmio_probe(struct platform_device *dev)
395 goto err_iomap_ccr; 395 goto err_iomap_ccr;
396 } 396 }
397 397
398 tmio->fcr_phys = (unsigned long)fcr->start; 398 tmio->fcr_base = fcr->start & 0xfffff;
399 tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1); 399 tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1);
400 if (!tmio->fcr) { 400 if (!tmio->fcr) {
401 retval = -EIO; 401 retval = -EIO;