aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/m25p80.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/m25p80.c')
-rw-r--r--drivers/mtd/devices/m25p80.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index f90941a785e4..6f512b5c117b 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -347,8 +347,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
347 spi_message_add_tail(&t[1], &m); 347 spi_message_add_tail(&t[1], &m);
348 348
349 /* Byte count starts at zero. */ 349 /* Byte count starts at zero. */
350 if (retlen) 350 *retlen = 0;
351 *retlen = 0;
352 351
353 mutex_lock(&flash->lock); 352 mutex_lock(&flash->lock);
354 353
@@ -394,8 +393,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
394 dev_name(&flash->spi->dev), __func__, "to", 393 dev_name(&flash->spi->dev), __func__, "to",
395 (u32)to, len); 394 (u32)to, len);
396 395
397 if (retlen) 396 *retlen = 0;
398 *retlen = 0;
399 397
400 /* sanity checks */ 398 /* sanity checks */
401 if (!len) 399 if (!len)
@@ -466,8 +464,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
466 464
467 spi_sync(flash->spi, &m); 465 spi_sync(flash->spi, &m);
468 466
469 if (retlen) 467 *retlen += m.actual_length - m25p_cmdsz(flash);
470 *retlen += m.actual_length - m25p_cmdsz(flash);
471 } 468 }
472 } 469 }
473 470
@@ -485,8 +482,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
485 size_t actual; 482 size_t actual;
486 int cmd_sz, ret; 483 int cmd_sz, ret;
487 484
488 if (retlen) 485 *retlen = 0;
489 *retlen = 0;
490 486
491 /* sanity checks */ 487 /* sanity checks */
492 if (!len) 488 if (!len)
@@ -797,7 +793,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
797 break; 793 break;
798 } 794 }
799 795
800 if (plat_id) 796 if (i < ARRAY_SIZE(m25p_ids) - 1)
801 id = plat_id; 797 id = plat_id;
802 else 798 else
803 dev_warn(&spi->dev, "unrecognized id %s\n", data->type); 799 dev_warn(&spi->dev, "unrecognized id %s\n", data->type);