aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/m25p80.c4
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 45108ed85588..d5f24089be71 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -378,7 +378,9 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
378 378
379 spi_sync(flash->spi, &m); 379 spi_sync(flash->spi, &m);
380 380
381 *retlen += m.actual_length - sizeof(flash->command); 381 if (retlen)
382 *retlen += m.actual_length
383 - sizeof(flash->command);
382 } 384 }
383 } 385 }
384 386
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 99d3a0320fc9..155737e7483f 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -508,7 +508,7 @@ add_dataflash(struct spi_device *spi, char *name,
508 priv->partitioned = 1; 508 priv->partitioned = 1;
509 return add_mtd_partitions(device, parts, nr_parts); 509 return add_mtd_partitions(device, parts, nr_parts);
510 } 510 }
511 } else if (pdata->nr_parts) 511 } else if (pdata && pdata->nr_parts)
512 dev_warn(&spi->dev, "ignoring %d default partitions on %s\n", 512 dev_warn(&spi->dev, "ignoring %d default partitions on %s\n",
513 pdata->nr_parts, device->name); 513 pdata->nr_parts, device->name);
514 514