MTD progmem: Fix an address calculation

This commit is contained in:
Gregory Nutt 2015-11-13 11:32:34 -06:00
parent 2706b4f8aa
commit 015429684f
3 changed files with 4 additions and 5 deletions

2
arch

@ -1 +1 @@
Subproject commit 24f87df3fa8d9fec9044e2c2bb37d12260fd02de
Subproject commit 1c26392bebcb3135b214e12594b701c172bd1236

View File

@ -329,7 +329,7 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
buffer += dev->geo.erasesize;
}
/* Finally, handler any partial blocks after the last full erase block */
/* Finally, handle any partial blocks after the last full erase block */
if (remaining > 0)
{

View File

@ -41,6 +41,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
@ -199,15 +200,13 @@ static ssize_t progmem_bread(FAR struct mtd_dev_s *dev, off_t startblock,
{
FAR struct progmem_dev_s *priv = (FAR struct progmem_dev_s *)dev;
FAR const uint8_t *src;
size_t offset;
/* Read the specified blocks into the provided user buffer and return
* status (The positive, number of blocks actually read or a negated
* errno).
*/
offset = startblock << priv->blkshift;
src = (FAR const uint8_t *)up_progmem_getaddress(offset);
src = (FAR const uint8_t *)up_progmem_getaddress(startblock);
memcpy(buffer, src, nblocks << priv->blkshift);
return nblocks;
}