[PATCH] regulator: da9211: Check return value of devm_kzalloc()

From: Axel Lin
Date: Sun Aug 17 2014 - 06:35:21 EST


Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
---
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 ccc2e36..a26f1d2 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);
--
1.9.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/