diff options
Diffstat (limited to 'drivers/mtd/devices/ms02-nv.c')
-rw-r--r-- | drivers/mtd/devices/ms02-nv.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c index 8423fb6d4f26..182849d39c61 100644 --- a/drivers/mtd/devices/ms02-nv.c +++ b/drivers/mtd/devices/ms02-nv.c | |||
@@ -59,12 +59,8 @@ static int ms02nv_read(struct mtd_info *mtd, loff_t from, | |||
59 | { | 59 | { |
60 | struct ms02nv_private *mp = mtd->priv; | 60 | struct ms02nv_private *mp = mtd->priv; |
61 | 61 | ||
62 | if (from + len > mtd->size) | ||
63 | return -EINVAL; | ||
64 | |||
65 | memcpy(buf, mp->uaddr + from, len); | 62 | memcpy(buf, mp->uaddr + from, len); |
66 | *retlen = len; | 63 | *retlen = len; |
67 | |||
68 | return 0; | 64 | return 0; |
69 | } | 65 | } |
70 | 66 | ||
@@ -73,12 +69,8 @@ static int ms02nv_write(struct mtd_info *mtd, loff_t to, | |||
73 | { | 69 | { |
74 | struct ms02nv_private *mp = mtd->priv; | 70 | struct ms02nv_private *mp = mtd->priv; |
75 | 71 | ||
76 | if (to + len > mtd->size) | ||
77 | return -EINVAL; | ||
78 | |||
79 | memcpy(mp->uaddr + to, buf, len); | 72 | memcpy(mp->uaddr + to, buf, len); |
80 | *retlen = len; | 73 | *retlen = len; |
81 | |||
82 | return 0; | 74 | return 0; |
83 | } | 75 | } |
84 | 76 | ||
@@ -215,8 +207,8 @@ static int __init ms02nv_init_one(ulong addr) | |||
215 | mtd->size = fixsize; | 207 | mtd->size = fixsize; |
216 | mtd->name = (char *)ms02nv_name; | 208 | mtd->name = (char *)ms02nv_name; |
217 | mtd->owner = THIS_MODULE; | 209 | mtd->owner = THIS_MODULE; |
218 | mtd->read = ms02nv_read; | 210 | mtd->_read = ms02nv_read; |
219 | mtd->write = ms02nv_write; | 211 | mtd->_write = ms02nv_write; |
220 | mtd->writesize = 1; | 212 | mtd->writesize = 1; |
221 | 213 | ||
222 | ret = -EIO; | 214 | ret = -EIO; |