Skip to content
Snippets Groups Projects
Commit 3f990dc8 authored by pekon gupta's avatar pekon gupta Committed by Tom Rini
Browse files

mtd: nand: omap: fix error-codes returned from omap-elm driver


This patch
 omap-elm.c: replaces -ve integer value returned during errorneous condition,
             with proper error-codes.
 omap-gpmc.c: updates omap-gpmc driver to pass error-codes returned from
             omap-elm driver to upper layers

Signed-off-by: default avatarPekon Gupta <pekon@ti.com>
Reviewed-by: default avatarStefan Roese <sr@denx.de>
parent a09431da
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/mtd/omap_elm.h> #include <linux/mtd/omap_elm.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#define DRIVER_NAME "omap-elm"
#define ELM_DEFAULT_POLY (0) #define ELM_DEFAULT_POLY (0)
struct elm *elm_cfg; struct elm *elm_cfg;
...@@ -113,8 +114,10 @@ int elm_check_error(u8 *syndrome, enum bch_level bch_type, u32 *error_count, ...@@ -113,8 +114,10 @@ int elm_check_error(u8 *syndrome, enum bch_level bch_type, u32 *error_count,
/* check if correctable */ /* check if correctable */
location_status = readl(&elm_cfg->error_location[poly].location_status); location_status = readl(&elm_cfg->error_location[poly].location_status);
if (!(location_status & ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK)) if (!(location_status & ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK)) {
return -1; printf("%s: uncorrectable ECC errors\n", DRIVER_NAME);
return -EBADMSG;
}
/* get error count */ /* get error count */
*error_count = readl(&elm_cfg->error_location[poly].location_status) & *error_count = readl(&elm_cfg->error_location[poly].location_status) &
......
...@@ -370,10 +370,10 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, ...@@ -370,10 +370,10 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat,
} }
/* use elm module to check for errors */ /* use elm module to check for errors */
elm_config(bch_type); elm_config(bch_type);
if (elm_check_error(calc_ecc, bch_type, &error_count, error_loc)) { err = elm_check_error(calc_ecc, bch_type, &error_count, error_loc);
printf("nand: error: uncorrectable ECC errors\n"); if (err)
return -EINVAL; return err;
}
/* correct bch error */ /* correct bch error */
for (count = 0; count < error_count; count++) { for (count = 0; count < error_count; count++) {
switch (info->ecc_scheme) { switch (info->ecc_scheme) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment