Commit a7834704 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: trivial drivers/char/* annotation and format fixes

 - trivial annotation in several places in drivers/mtd
 - a bunch of debugging printks switched from %x to %llx (they get 64bit
   values)
 - in doc200[01].c fixed type of (unused) last argument in their
   doc_read_ecc().
parent 8412a0db
...@@ -378,7 +378,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr ...@@ -378,7 +378,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
chip->state = FL_ERASING; chip->state = FL_ERASING;
chip->oldstate = FL_READY; chip->oldstate = FL_READY;
printk(KERN_ERR "Chip not ready after erase " printk(KERN_ERR "Chip not ready after erase "
"suspended: status = 0x%x\n", status); "suspended: status = 0x%llx\n", status);
return -EIO; return -EIO;
} }
...@@ -963,7 +963,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip, ...@@ -963,7 +963,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
So we must check here and reset those bits if they're set. Otherwise So we must check here and reset those bits if they're set. Otherwise
we're just pissing in the wind */ we're just pissing in the wind */
if (status & CMD(0x30)) { if (status & CMD(0x30)) {
printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %x). Clearing.\n", status); printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %llx). Clearing.\n", status);
cfi_write(map, CMD(0x50), cmd_adr); cfi_write(map, CMD(0x50), cmd_adr);
cfi_write(map, CMD(0x70), cmd_adr); cfi_write(map, CMD(0x70), cmd_adr);
} }
......
...@@ -509,7 +509,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned ...@@ -509,7 +509,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
chip->state = FL_WRITING; chip->state = FL_WRITING;
adr += chip->start; adr += chip->start;
DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): WRITE 0x%.8lx(0x%.8x)\n", DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): WRITE 0x%.8lx(0x%.8llx)\n",
__func__, adr, datum ); __func__, adr, datum );
ENABLE_VPP(map); ENABLE_VPP(map);
...@@ -645,7 +645,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned ...@@ -645,7 +645,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
__func__ ); __func__ );
printk(KERN_WARNING printk(KERN_WARNING
"MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n", "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, datum, __func__, adr, datum,
prev_oldstatus, prev_status, prev_oldstatus, prev_status,
oldstatus, status); oldstatus, status);
...@@ -971,7 +971,7 @@ static inline int do_erase_chip(struct map_info *map, struct flchip *chip) ...@@ -971,7 +971,7 @@ static inline int do_erase_chip(struct map_info *map, struct flchip *chip)
__func__ ); __func__ );
printk(KERN_WARNING printk(KERN_WARNING
"MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n", "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, ones, __func__, adr, ones,
prev_oldstatus, prev_status, prev_oldstatus, prev_status,
oldstatus, status); oldstatus, status);
...@@ -1151,7 +1151,7 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u ...@@ -1151,7 +1151,7 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u
__func__ ); __func__ );
printk(KERN_WARNING printk(KERN_WARNING
"MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n", "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, ones, __func__, adr, ones,
prev_oldstatus, prev_status, prev_oldstatus, prev_status,
oldstatus, status); oldstatus, status);
......
...@@ -489,7 +489,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip, ...@@ -489,7 +489,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
/* Urgh. Chip not yet ready to talk to us. */ /* Urgh. Chip not yet ready to talk to us. */
if (time_after(jiffies, timeo)) { if (time_after(jiffies, timeo)) {
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
printk(KERN_ERR "waiting for chip to be ready timed out in buffer write Xstatus = %x, status = %x\n", printk(KERN_ERR "waiting for chip to be ready timed out in buffer write Xstatus = %x, status = %llx\n",
status, cfi_read(map, cmd_adr)); status, cfi_read(map, cmd_adr));
return -EIO; return -EIO;
} }
...@@ -859,7 +859,7 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u ...@@ -859,7 +859,7 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u
if (time_after(jiffies, timeo)) { if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr); cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
printk(KERN_ERR "waiting for erase to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr)); printk(KERN_ERR "waiting for erase to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map); DISABLE_VPP(map);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
return -EIO; return -EIO;
...@@ -1145,7 +1145,7 @@ static inline int do_lock_oneblock(struct map_info *map, struct flchip *chip, un ...@@ -1145,7 +1145,7 @@ static inline int do_lock_oneblock(struct map_info *map, struct flchip *chip, un
if (time_after(jiffies, timeo)) { if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr); cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
printk(KERN_ERR "waiting for lock to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr)); printk(KERN_ERR "waiting for lock to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map); DISABLE_VPP(map);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
return -EIO; return -EIO;
...@@ -1294,7 +1294,7 @@ static inline int do_unlock_oneblock(struct map_info *map, struct flchip *chip, ...@@ -1294,7 +1294,7 @@ static inline int do_unlock_oneblock(struct map_info *map, struct flchip *chip,
if (time_after(jiffies, timeo)) { if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr); cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
printk(KERN_ERR "waiting for unlock to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr)); printk(KERN_ERR "waiting for unlock to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map); DISABLE_VPP(map);
spin_unlock_bh(chip->mutex); spin_unlock_bh(chip->mutex);
return -EIO; return -EIO;
......
...@@ -53,9 +53,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -53,9 +53,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf); size_t *retlen, const u_char *buf);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel); size_t *retlen, u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel); size_t *retlen, const u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused);
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf); size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
...@@ -601,7 +603,8 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -601,7 +603,8 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
} }
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t * retlen, u_char * buf, u_char * eccbuf, int oobsel) size_t * retlen, u_char * buf, u_char * eccbuf,
struct nand_oobinfo *unused)
{ {
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv; struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
unsigned long docptr; unsigned long docptr;
...@@ -750,7 +753,8 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -750,7 +753,8 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t * retlen, const u_char * buf, size_t * retlen, const u_char * buf,
u_char * eccbuf, int oobsel) u_char * eccbuf,
struct nand_oobinfo *unused)
{ {
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv; struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */ int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */
......
...@@ -37,9 +37,12 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -37,9 +37,12 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf); size_t *retlen, const u_char *buf);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel); size_t *retlen, u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel); size_t *retlen, const u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused);
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf); size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
...@@ -407,7 +410,8 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, ...@@ -407,7 +410,8 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
} }
static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel) size_t *retlen, u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused)
{ {
int i, ret; int i, ret;
volatile char dummy; volatile char dummy;
...@@ -533,7 +537,8 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, ...@@ -533,7 +537,8 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len,
} }
static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel) size_t *retlen, const u_char *buf, u_char *eccbuf,
struct nand_oobinfo *unused)
{ {
int i,ret = 0; int i,ret = 0;
volatile char dummy; volatile char dummy;
......
...@@ -220,7 +220,7 @@ static int blktrans_ioctl(struct inode *inode, struct file *file, ...@@ -220,7 +220,7 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
g.start = get_start_sect(inode->i_bdev); g.start = get_start_sect(inode->i_bdev);
if (copy_to_user((void *)arg, &g, sizeof(g))) if (copy_to_user((void __user *)arg, &g, sizeof(g)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} /* else */ } /* else */
......
...@@ -116,7 +116,7 @@ static int mtd_close(struct inode *inode, struct file *file) ...@@ -116,7 +116,7 @@ static int mtd_close(struct inode *inode, struct file *file)
*/ */
#define MAX_KMALLOC_SIZE 0x20000 #define MAX_KMALLOC_SIZE 0x20000
static ssize_t mtd_read(struct file *file, char *buf, size_t count,loff_t *ppos) static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t *ppos)
{ {
struct mtd_info *mtd = (struct mtd_info *)file->private_data; struct mtd_info *mtd = (struct mtd_info *)file->private_data;
size_t retlen=0; size_t retlen=0;
...@@ -169,7 +169,7 @@ static ssize_t mtd_read(struct file *file, char *buf, size_t count,loff_t *ppos) ...@@ -169,7 +169,7 @@ static ssize_t mtd_read(struct file *file, char *buf, size_t count,loff_t *ppos)
return total_retlen; return total_retlen;
} /* mtd_read */ } /* mtd_read */
static ssize_t mtd_write(struct file *file, const char *buf, size_t count,loff_t *ppos) static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count,loff_t *ppos)
{ {
struct mtd_info *mtd = (struct mtd_info *)file->private_data; struct mtd_info *mtd = (struct mtd_info *)file->private_data;
char *kbuf; char *kbuf;
...@@ -238,6 +238,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -238,6 +238,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
u_int cmd, u_long arg) u_int cmd, u_long arg)
{ {
struct mtd_info *mtd = (struct mtd_info *)file->private_data; struct mtd_info *mtd = (struct mtd_info *)file->private_data;
void __user *argp = (void __user *)arg;
int ret = 0; int ret = 0;
u_long size; u_long size;
...@@ -245,17 +246,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -245,17 +246,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
if (cmd & IOC_IN) { if (cmd & IOC_IN) {
ret = verify_area(VERIFY_READ, (char *)arg, size); ret = verify_area(VERIFY_READ, argp, size);
if (ret) return ret; if (ret) return ret;
} }
if (cmd & IOC_OUT) { if (cmd & IOC_OUT) {
ret = verify_area(VERIFY_WRITE, (char *)arg, size); ret = verify_area(VERIFY_WRITE, argp, size);
if (ret) return ret; if (ret) return ret;
} }
switch (cmd) { switch (cmd) {
case MEMGETREGIONCOUNT: case MEMGETREGIONCOUNT:
if (copy_to_user((int *) arg, &(mtd->numeraseregions), sizeof(int))) if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int)))
return -EFAULT; return -EFAULT;
break; break;
...@@ -263,24 +264,19 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -263,24 +264,19 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{ {
struct region_info_user ur; struct region_info_user ur;
if (copy_from_user( &ur, if (copy_from_user(&ur, argp, sizeof(struct region_info_user)))
(struct region_info_user *)arg,
sizeof(struct region_info_user))) {
return -EFAULT; return -EFAULT;
}
if (ur.regionindex >= mtd->numeraseregions) if (ur.regionindex >= mtd->numeraseregions)
return -EINVAL; return -EINVAL;
if (copy_to_user((struct mtd_erase_region_info *) arg, if (copy_to_user(argp, &(mtd->eraseregions[ur.regionindex]),
&(mtd->eraseregions[ur.regionindex]),
sizeof(struct mtd_erase_region_info))) sizeof(struct mtd_erase_region_info)))
return -EFAULT; return -EFAULT;
break; break;
} }
case MEMGETINFO: case MEMGETINFO:
if (copy_to_user((struct mtd_info *)arg, mtd, if (copy_to_user(argp, mtd, sizeof(struct mtd_info_user)))
sizeof(struct mtd_info_user)))
return -EFAULT; return -EFAULT;
break; break;
...@@ -301,7 +297,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -301,7 +297,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
init_waitqueue_head(&waitq); init_waitqueue_head(&waitq);
memset (erase,0,sizeof(struct erase_info)); memset (erase,0,sizeof(struct erase_info));
if (copy_from_user(&erase->addr, (u_long *)arg, if (copy_from_user(&erase->addr, argp,
2 * sizeof(u_long))) { 2 * sizeof(u_long))) {
kfree(erase); kfree(erase);
return -EFAULT; return -EFAULT;
...@@ -345,7 +341,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -345,7 +341,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if(!(file->f_mode & 2)) if(!(file->f_mode & 2))
return -EPERM; return -EPERM;
if (copy_from_user(&buf, (struct mtd_oob_buf *)arg, sizeof(struct mtd_oob_buf))) if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
return -EFAULT; return -EFAULT;
if (buf.length > 0x4096) if (buf.length > 0x4096)
...@@ -354,7 +350,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -354,7 +350,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if (!mtd->write_oob) if (!mtd->write_oob)
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
else else
ret = verify_area(VERIFY_READ, (char *)buf.ptr, buf.length); ret = verify_area(VERIFY_READ, buf.ptr, buf.length);
if (ret) if (ret)
return ret; return ret;
...@@ -370,7 +366,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -370,7 +366,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ret = (mtd->write_oob)(mtd, buf.start, buf.length, &retlen, databuf); ret = (mtd->write_oob)(mtd, buf.start, buf.length, &retlen, databuf);
if (copy_to_user((void *)arg + sizeof(u_int32_t), &retlen, sizeof(u_int32_t))) if (copy_to_user(argp + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
ret = -EFAULT; ret = -EFAULT;
kfree(databuf); kfree(databuf);
...@@ -384,7 +380,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -384,7 +380,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
void *databuf; void *databuf;
ssize_t retlen; ssize_t retlen;
if (copy_from_user(&buf, (struct mtd_oob_buf *)arg, sizeof(struct mtd_oob_buf))) if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
return -EFAULT; return -EFAULT;
if (buf.length > 0x4096) if (buf.length > 0x4096)
...@@ -393,7 +389,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -393,7 +389,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if (!mtd->read_oob) if (!mtd->read_oob)
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
else else
ret = verify_area(VERIFY_WRITE, (char *)buf.ptr, buf.length); ret = verify_area(VERIFY_WRITE, buf.ptr, buf.length);
if (ret) if (ret)
return ret; return ret;
...@@ -404,7 +400,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -404,7 +400,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ret = (mtd->read_oob)(mtd, buf.start, buf.length, &retlen, databuf); ret = (mtd->read_oob)(mtd, buf.start, buf.length, &retlen, databuf);
if (copy_to_user((void *)arg + sizeof(u_int32_t), &retlen, sizeof(u_int32_t))) if (copy_to_user(argp + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
ret = -EFAULT; ret = -EFAULT;
else if (retlen && copy_to_user(buf.ptr, databuf, retlen)) else if (retlen && copy_to_user(buf.ptr, databuf, retlen))
ret = -EFAULT; ret = -EFAULT;
...@@ -417,7 +413,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -417,7 +413,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{ {
unsigned long adrs[2]; unsigned long adrs[2];
if (copy_from_user(adrs ,(void *)arg, 2* sizeof(unsigned long))) if (copy_from_user(adrs, argp, 2* sizeof(unsigned long)))
return -EFAULT; return -EFAULT;
if (!mtd->lock) if (!mtd->lock)
...@@ -431,7 +427,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -431,7 +427,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{ {
unsigned long adrs[2]; unsigned long adrs[2];
if (copy_from_user(adrs, (void *)arg, 2* sizeof(unsigned long))) if (copy_from_user(adrs, argp, 2* sizeof(unsigned long)))
return -EFAULT; return -EFAULT;
if (!mtd->unlock) if (!mtd->unlock)
...@@ -443,7 +439,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file, ...@@ -443,7 +439,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
case MEMSETOOBSEL: case MEMSETOOBSEL:
{ {
if (copy_from_user(&mtd->oobinfo ,(void *)arg, sizeof(struct nand_oobinfo))) if (copy_from_user(&mtd->oobinfo, argp, sizeof(struct nand_oobinfo)))
return -EFAULT; return -EFAULT;
break; break;
} }
......
...@@ -22,7 +22,7 @@ struct erase_info_user { ...@@ -22,7 +22,7 @@ struct erase_info_user {
struct mtd_oob_buf { struct mtd_oob_buf {
u_int32_t start; u_int32_t start;
u_int32_t length; u_int32_t length;
unsigned char *ptr; unsigned char __user *ptr;
}; };
#define MTD_CHAR_MAJOR 90 #define MTD_CHAR_MAJOR 90
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment