From 1d3e6a6985c14f0510ebbd81fb9e8c02b24f8791 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 17 Aug 2014 18:34:48 +0800 Subject: [PATCH] regulator: da9211: Check return value of devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/da9211-regulator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index ccc2e362d751..a26f1d283c57 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -343,6 +343,8 @@ static int da9211_i2c_probe(struct i2c_client *i2c, unsigned int data; chip = devm_kzalloc(&i2c->dev, sizeof(struct da9211), GFP_KERNEL); + if (!chip) + return -ENOMEM; chip->dev = &i2c->dev; chip->regmap = devm_regmap_init_i2c(i2c, &da9211_regmap_config);