aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/devices/elm.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2013-05-15 12:42:15 -0700
committerJohn Stultz <john.stultz@linaro.org>2013-05-15 12:42:15 -0700
commit15a6affec4449b54afba15ab7edbad0cac2736d3 (patch)
treef2fa815f74be0b56acd05e62113600a7113d48a9 /drivers/mtd/devices/elm.c
parentcd432fc233f4e7aba43b4fe499a4445f0f6ee1c6 (diff)
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
Merge tag 'v3.10-rc1' into linaro-android-3.10-experimental-mergetracking-linaro-android-3.10-llct-20130518.0
Linux 3.10-rc1
Diffstat (limited to 'drivers/mtd/devices/elm.c')
-rw-r--r--drivers/mtd/devices/elm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index 2ec5da9ee248..dccef9fdc1f2 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -81,14 +81,21 @@ static u32 elm_read_reg(struct elm_info *info, int offset)
* @dev: ELM device
* @bch_type: Type of BCH ecc
*/
-void elm_config(struct device *dev, enum bch_ecc bch_type)
+int elm_config(struct device *dev, enum bch_ecc bch_type)
{
u32 reg_val;
struct elm_info *info = dev_get_drvdata(dev);
+ if (!info) {
+ dev_err(dev, "Unable to configure elm - device not probed?\n");
+ return -ENODEV;
+ }
+
reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16);
elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val);
info->bch_type = bch_type;
+
+ return 0;
}
EXPORT_SYMBOL(elm_config);