aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorDan Brown <dan_brown@ieee.org>2005-04-04 14:02:26 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 07:08:47 -0400
commitbb75ba4c442c6aa73797c35651a697b0a8006bd6 (patch)
treea9c22a462f46fb722155049092975f9772a254f6 /drivers/mtd
parentdce2b4da69a83635150a6535ebc23f680e200a8d (diff)
[MTD] NAND: Fix missing NULL pointer check
Version 1.137 broke nand_read_ecc clients who pass NULL oobsel. Fixed. Signed-off-by: Dan Brown <dan_brown@ieee.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index aea87f05389e..0da1daa51646 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -59,7 +59,7 @@
59 * The AG-AND chips have nice features for speed improvement, 59 * The AG-AND chips have nice features for speed improvement,
60 * which are not supported yet. Read / program 4 pages in one go. 60 * which are not supported yet. Read / program 4 pages in one go.
61 * 61 *
62 * $Id: nand_base.c,v 1.138 2005/04/01 07:21:44 gleixner Exp $ 62 * $Id: nand_base.c,v 1.139 2005/04/04 18:02:23 dbrown Exp $
63 * 63 *
64 * This program is free software; you can redistribute it and/or modify 64 * This program is free software; you can redistribute it and/or modify
65 * it under the terms of the GNU General Public License version 2 as 65 * it under the terms of the GNU General Public License version 2 as
@@ -1090,8 +1090,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
1090 * @len: number of bytes to read 1090 * @len: number of bytes to read
1091 * @retlen: pointer to variable to store the number of read bytes 1091 * @retlen: pointer to variable to store the number of read bytes
1092 * @buf: the databuffer to put data 1092 * @buf: the databuffer to put data
1093 * @oob_buf: filesystem supplied oob data buffer 1093 * @oob_buf: filesystem supplied oob data buffer (can be NULL)
1094 * @oobsel: oob selection structure 1094 * @oobsel: oob selection structure (can be NULL)
1095 * @flags: flag to indicate if nand_get_device/nand_release_device should be preformed 1095 * @flags: flag to indicate if nand_get_device/nand_release_device should be preformed
1096 * and how many corrected error bits are acceptable: 1096 * and how many corrected error bits are acceptable:
1097 * bits 0..7 - number of tolerable errors 1097 * bits 0..7 - number of tolerable errors
@@ -1103,6 +1103,10 @@ int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
1103 size_t * retlen, u_char * buf, u_char * oob_buf, 1103 size_t * retlen, u_char * buf, u_char * oob_buf,
1104 struct nand_oobinfo *oobsel, int flags) 1104 struct nand_oobinfo *oobsel, int flags)
1105{ 1105{
1106 /* use userspace supplied oobinfo, if zero */
1107 if (oobsel == NULL)
1108 oobsel = &mtd->oobinfo;
1109
1106 int i, j, col, realpage, page, end, ecc, chipnr, sndcmd = 1; 1110 int i, j, col, realpage, page, end, ecc, chipnr, sndcmd = 1;
1107 int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0; 1111 int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0;
1108 struct nand_chip *this = mtd->priv; 1112 struct nand_chip *this = mtd->priv;
@@ -1130,10 +1134,6 @@ int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
1130 if (flags & NAND_GET_DEVICE) 1134 if (flags & NAND_GET_DEVICE)
1131 nand_get_device (this, mtd, FL_READING); 1135 nand_get_device (this, mtd, FL_READING);
1132 1136
1133 /* use userspace supplied oobinfo, if zero */
1134 if (oobsel == NULL)
1135 oobsel = &mtd->oobinfo;
1136
1137 /* Autoplace of oob data ? Use the default placement scheme */ 1137 /* Autoplace of oob data ? Use the default placement scheme */
1138 if (oobsel->useecc == MTD_NANDECC_AUTOPLACE) 1138 if (oobsel->useecc == MTD_NANDECC_AUTOPLACE)
1139 oobsel = this->autooob; 1139 oobsel = this->autooob;