diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-02-05 22:21:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-02-11 09:49:30 +0100 |
commit | dd6090ecba3fdc965600430b1e258faf5236954d (patch) | |
tree | f46aff3a0bcf67d602d49d1345a8f2088b4fe6bb /drivers | |
parent | 1a0ab5e97e5d7a64aec26dfdb6e480003e91d45b (diff) | |
download | barebox-dd6090ecba3fdc965600430b1e258faf5236954d.tar.gz barebox-dd6090ecba3fdc965600430b1e258faf5236954d.tar.xz |
mtd: nand-imx: don't copy more bytes than read from hardware
The NFC command used for reading the result of a READID command to the NAND chip
reads 6 bytes (in x8 mode) or 6 words (in x16 mode with the upper bytes all
being 0). So there is no need to safe 16 bytes for later consumption.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/nand_imx.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c index 6857509913..00c05d00af 100644 --- a/drivers/mtd/nand/nand_imx.c +++ b/drivers/mtd/nand/nand_imx.c @@ -362,7 +362,11 @@ static void send_read_id_v3(struct imx_nand_host *host) wait_op_done(host); - memcpy(host->data_buf, host->main_area0, 16); + /* + * NFC_ID results in reading 6 bytes or words (depending on data width), + * so copying 3 32-bit values is just fine. + */ + memcpy(host->data_buf, host->main_area0, 12); } static void send_read_param_v3(struct imx_nand_host *host) |