int ret;
/* Do not allow write past end of device */
- if ((instr->addr + instr->len) > mtd->size) {
+ if ((instr->addr + instr->len) > msm->cinfo.chipsize) {
dev_err(msm->pdev.dev,
"attempt to erase beyond end of device\n");
return -EINVAL;
maxooblen = mtd_oobavail(mtd, ops);
/* Do not allow read past end of device */
- if (ops->datbuf && (from + ops->len) > mtd->size) {
+ if (ops->datbuf && (from + ops->len) > msm->cinfo.chipsize) {
dev_err(msm->pdev.dev,
"attempt to read beyond end of device\n");
return -EINVAL;
return -EINVAL;
}
- if (unlikely(from >= mtd->size ||
- ops->ooboffs + ops->ooblen > ((mtd->size >> mtd->writesize_shift) -
- (from >> mtd->writesize_shift)) * maxooblen)) {
+ if (unlikely(from >= msm->cinfo.chipsize ||
+ ops->ooboffs + ops->ooblen >
+ ((msm->cinfo.chipsize >> mtd->writesize_shift) -
+ (from >> mtd->writesize_shift)) *
+ maxooblen)) {
dev_err(msm->pdev.dev,
"attempt to read beyond end of device\n");
return -EINVAL;
maxooblen = mtd_oobavail(mtd, ops);
/* Do not allow write past end of device */
- if (ops->datbuf && (to + ops->len) > mtd->size) {
+ if (ops->datbuf && (to + ops->len) > msm->cinfo.chipsize) {
dev_err(msm->pdev.dev,
"attempt to write beyond end of device\n");
return -EINVAL;
return -EINVAL;
}
- if (unlikely(to >= mtd->size ||
- ops->ooboffs + ops->ooblen > ((mtd->size >> mtd->writesize_shift) -
- (to >> mtd->writesize_shift)) * maxooblen)) {
+ if (unlikely(to >= msm->cinfo.chipsize ||
+ ops->ooboffs + ops->ooblen >
+ ((msm->cinfo.chipsize >> mtd->writesize_shift) -
+ (to >> mtd->writesize_shift)) *
+ maxooblen)) {
dev_err(msm->pdev.dev,
"attempt to write beyond end of device\n");
return -EINVAL;