aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/mtdram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/mtdram.c')
-rw-r--r--drivers/mtd/devices/mtdram.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index e1f017bf0777..0e0e6ed4443c 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -34,27 +34,18 @@ static struct mtd_info *mtd_info;
34 34
35static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) 35static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
36{ 36{
37 if (instr->addr + instr->len > mtd->size)
38 return -EINVAL;
39
40 memset((char *)mtd->priv + instr->addr, 0xff, instr->len); 37 memset((char *)mtd->priv + instr->addr, 0xff, instr->len);
41
42 instr->state = MTD_ERASE_DONE; 38 instr->state = MTD_ERASE_DONE;
43 mtd_erase_callback(instr); 39 mtd_erase_callback(instr);
44
45 return 0; 40 return 0;
46} 41}
47 42
48static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, 43static int ram_point(struct mtd_info *mtd, loff_t from, size_t len,
49 size_t *retlen, void **virt, resource_size_t *phys) 44 size_t *retlen, void **virt, resource_size_t *phys)
50{ 45{
51 if (from + len > mtd->size)
52 return -EINVAL;
53
54 /* can we return a physical address with this driver? */ 46 /* can we return a physical address with this driver? */
55 if (phys) 47 if (phys)
56 return -EINVAL; 48 return -EINVAL;
57
58 *virt = mtd->priv + from; 49 *virt = mtd->priv + from;
59 *retlen = len; 50 *retlen = len;
60 return 0; 51 return 0;
@@ -81,11 +72,7 @@ static unsigned long ram_get_unmapped_area(struct mtd_info *mtd,
81static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, 72static int ram_read(struct mtd_info *mtd, loff_t from, size_t len,
82 size_t *retlen, u_char *buf) 73 size_t *retlen, u_char *buf)
83{ 74{
84 if (from + len > mtd->size)
85 return -EINVAL;
86
87 memcpy(buf, mtd->priv + from, len); 75 memcpy(buf, mtd->priv + from, len);
88
89 *retlen = len; 76 *retlen = len;
90 return 0; 77 return 0;
91} 78}
@@ -93,11 +80,7 @@ static int ram_read(struct mtd_info *mtd, loff_t from, size_t len,
93static int ram_write(struct mtd_info *mtd, loff_t to, size_t len, 80static int ram_write(struct mtd_info *mtd, loff_t to, size_t len,
94 size_t *retlen, const u_char *buf) 81 size_t *retlen, const u_char *buf)
95{ 82{
96 if (to + len > mtd->size)
97 return -EINVAL;
98
99 memcpy((char *)mtd->priv + to, buf, len); 83 memcpy((char *)mtd->priv + to, buf, len);
100
101 *retlen = len; 84 *retlen = len;
102 return 0; 85 return 0;
103} 86}