2019-05-21 01:08:14 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2011-03-11 18:05:33 +08:00
|
|
|
/*
|
|
|
|
* This file provides ECC correction for more than 1 bit per block of data,
|
|
|
|
* using binary BCH codes. It relies on the generic BCH library lib/bch.c.
|
|
|
|
*
|
|
|
|
* Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/mtd/mtd.h>
|
2017-08-04 23:29:10 +08:00
|
|
|
#include <linux/mtd/rawnand.h>
|
2020-09-30 07:01:06 +08:00
|
|
|
#include <linux/mtd/nand-ecc-sw-bch.h>
|
2011-03-11 18:05:33 +08:00
|
|
|
#include <linux/bch.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct nand_bch_control - private NAND BCH control structure
|
|
|
|
* @bch: BCH control structure
|
|
|
|
* @errloc: error location array
|
|
|
|
* @eccmask: XOR ecc mask, allows erased pages to be decoded as valid
|
|
|
|
*/
|
|
|
|
struct nand_bch_control {
|
|
|
|
struct bch_control *bch;
|
|
|
|
unsigned int *errloc;
|
|
|
|
unsigned char *eccmask;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-09-30 07:01:07 +08:00
|
|
|
* nand_bch_calcuate_ecc - Calculate the ECC corresponding to a data block
|
|
|
|
* @chip: NAND chip object
|
|
|
|
* @buf: Input buffer with raw data
|
|
|
|
* @code: Output buffer with ECC
|
2011-03-11 18:05:33 +08:00
|
|
|
*/
|
2018-09-06 20:05:18 +08:00
|
|
|
int nand_bch_calculate_ecc(struct nand_chip *chip, const unsigned char *buf,
|
2011-03-11 18:05:33 +08:00
|
|
|
unsigned char *code)
|
|
|
|
{
|
|
|
|
struct nand_bch_control *nbc = chip->ecc.priv;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
memset(code, 0, chip->ecc.bytes);
|
2020-05-19 15:45:42 +08:00
|
|
|
bch_encode(nbc->bch, buf, chip->ecc.size, code);
|
2011-03-11 18:05:33 +08:00
|
|
|
|
|
|
|
/* apply mask so that an erased page is a valid codeword */
|
|
|
|
for (i = 0; i < chip->ecc.bytes; i++)
|
|
|
|
code[i] ^= nbc->eccmask[i];
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(nand_bch_calculate_ecc);
|
|
|
|
|
|
|
|
/**
|
2020-09-30 07:01:07 +08:00
|
|
|
* nand_bch_correct_data - Detect, correct and report bit error(s)
|
|
|
|
* @chip: NAND chip object
|
|
|
|
* @buf: Raw data read from the chip
|
|
|
|
* @read_ecc: ECC bytes from the chip
|
|
|
|
* @calc_ecc: ECC calculated from the raw data
|
2011-03-11 18:05:33 +08:00
|
|
|
*
|
2020-09-30 07:01:07 +08:00
|
|
|
* Detect and correct bit errors for a data block.
|
2011-03-11 18:05:33 +08:00
|
|
|
*/
|
2018-09-06 20:05:19 +08:00
|
|
|
int nand_bch_correct_data(struct nand_chip *chip, unsigned char *buf,
|
2011-03-11 18:05:33 +08:00
|
|
|
unsigned char *read_ecc, unsigned char *calc_ecc)
|
|
|
|
{
|
|
|
|
struct nand_bch_control *nbc = chip->ecc.priv;
|
|
|
|
unsigned int *errloc = nbc->errloc;
|
|
|
|
int i, count;
|
|
|
|
|
2020-05-19 15:45:42 +08:00
|
|
|
count = bch_decode(nbc->bch, NULL, chip->ecc.size, read_ecc, calc_ecc,
|
2011-03-11 18:05:33 +08:00
|
|
|
NULL, errloc);
|
|
|
|
if (count > 0) {
|
|
|
|
for (i = 0; i < count; i++) {
|
2020-09-30 07:01:07 +08:00
|
|
|
if (errloc[i] < (chip->ecc.size * 8))
|
|
|
|
/* The error is in the data area: correct it */
|
2011-03-11 18:05:33 +08:00
|
|
|
buf[errloc[i] >> 3] ^= (1 << (errloc[i] & 7));
|
|
|
|
|
2020-09-30 07:01:07 +08:00
|
|
|
/* Otherwise the error is in the ECC area: nothing to do */
|
2011-07-20 01:06:10 +08:00
|
|
|
pr_debug("%s: corrected bitflip %u\n", __func__,
|
2020-09-30 07:01:07 +08:00
|
|
|
errloc[i]);
|
2011-03-11 18:05:33 +08:00
|
|
|
}
|
|
|
|
} else if (count < 0) {
|
2020-09-30 07:01:07 +08:00
|
|
|
pr_err("ECC unrecoverable error\n");
|
2015-12-31 03:32:03 +08:00
|
|
|
count = -EBADMSG;
|
2011-03-11 18:05:33 +08:00
|
|
|
}
|
2020-09-30 07:01:07 +08:00
|
|
|
|
2011-03-11 18:05:33 +08:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(nand_bch_correct_data);
|
|
|
|
|
|
|
|
/**
|
2020-09-30 07:01:07 +08:00
|
|
|
* nand_bch_init - Initialize software BCH ECC engine
|
2020-09-30 07:01:08 +08:00
|
|
|
* @chip: NAND chip object
|
2011-03-11 18:05:33 +08:00
|
|
|
*
|
2020-09-30 07:01:07 +08:00
|
|
|
* Returns: a pointer to a new NAND BCH control structure, or NULL upon failure
|
2011-03-11 18:05:33 +08:00
|
|
|
*
|
|
|
|
* Initialize NAND BCH error correction. Parameters @eccsize and @eccbytes
|
2020-09-30 07:01:07 +08:00
|
|
|
* are used to compute the following BCH parameters:
|
|
|
|
* m, the Galois field order
|
|
|
|
* t, the error correction capability
|
|
|
|
* @eccbytes should be equal to the number of bytes required to store m * t
|
|
|
|
* bits, where m is such that 2^m - 1 > step_size * 8.
|
2011-03-11 18:05:33 +08:00
|
|
|
*
|
|
|
|
* Example: to configure 4 bit correction per 512 bytes, you should pass
|
2020-09-30 07:01:07 +08:00
|
|
|
* @eccsize = 512 (thus, m = 13 is the smallest integer such that 2^m - 1 > 512 * 8)
|
|
|
|
* @eccbytes = 7 (7 bytes are required to store m * t = 13 * 4 = 52 bits)
|
2011-03-11 18:05:33 +08:00
|
|
|
*/
|
2020-09-30 07:01:08 +08:00
|
|
|
int nand_bch_init(struct nand_chip *chip)
|
2011-03-11 18:05:33 +08:00
|
|
|
{
|
2020-09-30 07:01:08 +08:00
|
|
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
2011-03-11 18:05:33 +08:00
|
|
|
unsigned int m, t, eccsteps, i;
|
|
|
|
struct nand_bch_control *nbc = NULL;
|
|
|
|
unsigned char *erased_page;
|
2020-09-30 07:01:08 +08:00
|
|
|
unsigned int eccsize = chip->ecc.size;
|
|
|
|
unsigned int eccbytes = chip->ecc.bytes;
|
|
|
|
unsigned int eccstrength = chip->ecc.strength;
|
2016-03-07 17:46:54 +08:00
|
|
|
|
|
|
|
if (!eccbytes && eccstrength) {
|
|
|
|
eccbytes = DIV_ROUND_UP(eccstrength * fls(8 * eccsize), 8);
|
2020-09-30 07:01:08 +08:00
|
|
|
chip->ecc.bytes = eccbytes;
|
2016-03-07 17:46:54 +08:00
|
|
|
}
|
2011-03-11 18:05:33 +08:00
|
|
|
|
|
|
|
if (!eccsize || !eccbytes) {
|
2018-02-23 00:31:22 +08:00
|
|
|
pr_warn("ecc parameters not supplied\n");
|
2020-09-30 07:01:08 +08:00
|
|
|
return -EINVAL;
|
2011-03-11 18:05:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
m = fls(1+8*eccsize);
|
|
|
|
t = (eccbytes*8)/m;
|
|
|
|
|
|
|
|
nbc = kzalloc(sizeof(*nbc), GFP_KERNEL);
|
|
|
|
if (!nbc)
|
2020-09-30 07:01:08 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
chip->ecc.priv = nbc;
|
2011-03-11 18:05:33 +08:00
|
|
|
|
2020-05-19 15:45:43 +08:00
|
|
|
nbc->bch = bch_init(m, t, 0, false);
|
2011-03-11 18:05:33 +08:00
|
|
|
if (!nbc->bch)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* verify that eccbytes has the expected value */
|
|
|
|
if (nbc->bch->ecc_bytes != eccbytes) {
|
2018-02-23 00:31:22 +08:00
|
|
|
pr_warn("invalid eccbytes %u, should be %u\n",
|
|
|
|
eccbytes, nbc->bch->ecc_bytes);
|
2011-03-11 18:05:33 +08:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
eccsteps = mtd->writesize/eccsize;
|
|
|
|
|
2016-02-04 02:53:40 +08:00
|
|
|
/* Check that we have an oob layout description. */
|
|
|
|
if (!mtd->ooblayout) {
|
|
|
|
pr_warn("missing oob scheme");
|
|
|
|
goto fail;
|
2011-03-11 18:05:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
if (8*(eccsize+eccbytes) >= (1 << m)) {
|
2018-02-23 00:31:22 +08:00
|
|
|
pr_warn("eccsize %u is too large\n", eccsize);
|
2011-03-11 18:05:33 +08:00
|
|
|
goto fail;
|
|
|
|
}
|
2016-02-04 03:11:00 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ecc->steps and ecc->total might be used by mtd->ooblayout->ecc(),
|
|
|
|
* which is called by mtd_ooblayout_count_eccbytes().
|
|
|
|
* Make sure they are properly initialized before calling
|
|
|
|
* mtd_ooblayout_count_eccbytes().
|
2016-05-07 00:31:18 +08:00
|
|
|
* FIXME: we should probably rework the sequencing in nand_scan_tail()
|
2016-02-04 03:11:00 +08:00
|
|
|
* to avoid setting those fields twice.
|
|
|
|
*/
|
2020-09-30 07:01:08 +08:00
|
|
|
chip->ecc.steps = eccsteps;
|
|
|
|
chip->ecc.total = eccsteps * eccbytes;
|
|
|
|
nand->base.ecc.ctx.total = chip->ecc.total;
|
2016-02-04 03:11:00 +08:00
|
|
|
if (mtd_ooblayout_count_eccbytes(mtd) != (eccsteps*eccbytes)) {
|
2018-02-23 00:31:22 +08:00
|
|
|
pr_warn("invalid ecc layout\n");
|
2011-03-11 18:05:33 +08:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2019-06-28 10:48:13 +08:00
|
|
|
nbc->eccmask = kzalloc(eccbytes, GFP_KERNEL);
|
treewide: kmalloc() -> kmalloc_array()
The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
patch replaces cases of:
kmalloc(a * b, gfp)
with:
kmalloc_array(a * b, gfp)
as well as handling cases of:
kmalloc(a * b * c, gfp)
with:
kmalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kmalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kmalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The tools/ directory was manually excluded, since it has its own
implementation of kmalloc().
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kmalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kmalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kmalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kmalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kmalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kmalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kmalloc
+ kmalloc_array
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kmalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kmalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kmalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kmalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kmalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kmalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kmalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kmalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kmalloc(C1 * C2 * C3, ...)
|
kmalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kmalloc(sizeof(THING) * C2, ...)
|
kmalloc(sizeof(TYPE) * C2, ...)
|
kmalloc(C1 * C2 * C3, ...)
|
kmalloc(C1 * C2, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- (E1) * E2
+ E1, E2
, ...)
|
- kmalloc
+ kmalloc_array
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kmalloc
+ kmalloc_array
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 04:55:00 +08:00
|
|
|
nbc->errloc = kmalloc_array(t, sizeof(*nbc->errloc), GFP_KERNEL);
|
2011-03-11 18:05:33 +08:00
|
|
|
if (!nbc->eccmask || !nbc->errloc)
|
|
|
|
goto fail;
|
2020-09-30 07:01:07 +08:00
|
|
|
|
2011-03-11 18:05:33 +08:00
|
|
|
/*
|
|
|
|
* compute and store the inverted ecc of an erased ecc block
|
|
|
|
*/
|
|
|
|
erased_page = kmalloc(eccsize, GFP_KERNEL);
|
|
|
|
if (!erased_page)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
memset(erased_page, 0xff, eccsize);
|
2020-05-19 15:45:42 +08:00
|
|
|
bch_encode(nbc->bch, erased_page, eccsize, nbc->eccmask);
|
2011-03-11 18:05:33 +08:00
|
|
|
kfree(erased_page);
|
|
|
|
|
|
|
|
for (i = 0; i < eccbytes; i++)
|
|
|
|
nbc->eccmask[i] ^= 0xff;
|
|
|
|
|
2016-03-07 17:46:54 +08:00
|
|
|
if (!eccstrength)
|
2020-09-30 07:01:08 +08:00
|
|
|
chip->ecc.strength = (eccbytes * 8) / fls(8 * eccsize);
|
2016-03-07 17:46:54 +08:00
|
|
|
|
2020-09-30 07:01:08 +08:00
|
|
|
return 0;
|
2011-03-11 18:05:33 +08:00
|
|
|
fail:
|
2020-09-30 07:01:08 +08:00
|
|
|
nand_bch_free(chip);
|
|
|
|
return -EINVAL;
|
2011-03-11 18:05:33 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(nand_bch_init);
|
|
|
|
|
|
|
|
/**
|
2020-09-30 07:01:07 +08:00
|
|
|
* nand_bch_free - Release NAND BCH ECC resources
|
|
|
|
* @nbc: NAND BCH control structure
|
2011-03-11 18:05:33 +08:00
|
|
|
*/
|
2020-09-30 07:01:08 +08:00
|
|
|
void nand_bch_free(struct nand_chip *chip)
|
2011-03-11 18:05:33 +08:00
|
|
|
{
|
2020-09-30 07:01:08 +08:00
|
|
|
struct nand_bch_control *nbc = chip->ecc.priv;
|
|
|
|
|
2011-03-11 18:05:33 +08:00
|
|
|
if (nbc) {
|
2020-05-19 15:45:42 +08:00
|
|
|
bch_free(nbc->bch);
|
2011-03-11 18:05:33 +08:00
|
|
|
kfree(nbc->errloc);
|
|
|
|
kfree(nbc->eccmask);
|
|
|
|
kfree(nbc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(nand_bch_free);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_AUTHOR("Ivan Djelic <ivan.djelic@parrot.com>");
|
|
|
|
MODULE_DESCRIPTION("NAND software BCH ECC support");
|