aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/omap2.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-03-03 18:57:20 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-04-05 07:57:18 -0400
commitad2457894c272279bf73ca46ae5ea5de4876d2a0 (patch)
tree11675f958813b5a7cefa1771212eaed57032acb1 /drivers/mtd/nand/omap2.c
parent0cca9fbf5d0a65fb536d38427f48460fda1f2e99 (diff)
mtd: devices: elm: check for device's presence before configuration
In case the driver is not probed - due to config mismatches or errors in the DTS files - dev_get_drvdata() returns NULL, leading to an Ooops during boot. Make elm_config() return an error in such cases to propagate the error up to the user, so it can fall back to software mode. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/omap2.c')
-rw-r--r--drivers/mtd/nand/omap2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 8e820ddf4e08..b97ef3b68ec6 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1701,8 +1701,9 @@ static int omap3_init_bch(struct mtd_info *mtd, int ecc_opt)
1701 elm_node = of_find_node_by_phandle(be32_to_cpup(parp)); 1701 elm_node = of_find_node_by_phandle(be32_to_cpup(parp));
1702 pdev = of_find_device_by_node(elm_node); 1702 pdev = of_find_device_by_node(elm_node);
1703 info->elm_dev = &pdev->dev; 1703 info->elm_dev = &pdev->dev;
1704 elm_config(info->elm_dev, bch_type); 1704
1705 info->is_elm_used = true; 1705 if (elm_config(info->elm_dev, bch_type) == 0)
1706 info->is_elm_used = true;
1706 } 1707 }
1707 1708
1708 if (info->is_elm_used && (mtd->writesize <= 4096)) { 1709 if (info->is_elm_used && (mtd->writesize <= 4096)) {