diff options
author | Kiran Padwal <kiran.padwal@smartplayin.com> | 2015-02-11 05:10:50 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-02-16 12:11:43 -0500 |
commit | 0a65fbf64dad890d9dd60ab1dc0ebdb9fb0a9e33 (patch) | |
tree | 0e4fb8be0b47c357f6cbeddb4a7cfc7de69f43f1 /drivers/mfd | |
parent | bb400d2120bd253d73661c452b18485d2d5b42dd (diff) |
mfd: intel_soc_pmic: Add missing error check for devm_kzalloc
This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.
Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/intel_soc_pmic_core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c index df7b0642a5b4..80cef048b904 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c | |||
@@ -64,6 +64,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, | |||
64 | config = (struct intel_soc_pmic_config *)id->driver_data; | 64 | config = (struct intel_soc_pmic_config *)id->driver_data; |
65 | 65 | ||
66 | pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); | 66 | pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); |
67 | if (!pmic) | ||
68 | return -ENOMEM; | ||
69 | |||
67 | dev_set_drvdata(dev, pmic); | 70 | dev_set_drvdata(dev, pmic); |
68 | 71 | ||
69 | pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config); | 72 | pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config); |