Commit 3f990dc83bc3197b17bd847241671917826152cc

Authored by pekon gupta
Committed by Tom Rini
1 parent a09431da38

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: Pekon Gupta <pekon@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>

Showing 2 changed files with 9 additions and 6 deletions Side-by-side Diff

drivers/mtd/nand/omap_elm.c
... ... @@ -19,6 +19,7 @@
19 19 #include <linux/mtd/omap_elm.h>
20 20 #include <asm/arch/hardware.h>
21 21  
  22 +#define DRIVER_NAME "omap-elm"
22 23 #define ELM_DEFAULT_POLY (0)
23 24  
24 25 struct elm *elm_cfg;
... ... @@ -113,8 +114,10 @@
113 114  
114 115 /* check if correctable */
115 116 location_status = readl(&elm_cfg->error_location[poly].location_status);
116   - if (!(location_status & ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK))
117   - return -1;
  117 + if (!(location_status & ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK)) {
  118 + printf("%s: uncorrectable ECC errors\n", DRIVER_NAME);
  119 + return -EBADMSG;
  120 + }
118 121  
119 122 /* get error count */
120 123 *error_count = readl(&elm_cfg->error_location[poly].location_status) &
drivers/mtd/nand/omap_gpmc.c
... ... @@ -370,10 +370,10 @@
370 370 }
371 371 /* use elm module to check for errors */
372 372 elm_config(bch_type);
373   - if (elm_check_error(calc_ecc, bch_type, &error_count, error_loc)) {
374   - printf("nand: error: uncorrectable ECC errors\n");
375   - return -EINVAL;
376   - }
  373 + err = elm_check_error(calc_ecc, bch_type, &error_count, error_loc);
  374 + if (err)
  375 + return err;
  376 +
377 377 /* correct bch error */
378 378 for (count = 0; count < error_count; count++) {
379 379 switch (info->ecc_scheme) {