From c88fd91bcd016b84e5f7d7ebd583e073e5ead48a Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 12 Feb 2014 14:40:13 +0530 Subject: mfd: stw481x: Check the return value of devm_regmap_init_i2c devm_regmap_init_i2c can fail. Check for it. Signed-off-by: Sachin Kamat Signed-off-by: Lee Jones --- drivers/mfd/stw481x.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/mfd/stw481x.c b/drivers/mfd/stw481x.c index cc42f88586f..7ceb3df09e2 100644 --- a/drivers/mfd/stw481x.c +++ b/drivers/mfd/stw481x.c @@ -186,6 +186,12 @@ static int stw481x_probe(struct i2c_client *client, i2c_set_clientdata(client, stw481x); stw481x->client = client; stw481x->map = devm_regmap_init_i2c(client, &stw481x_regmap_config); + if (IS_ERR(stw481x->map)) { + ret = PTR_ERR(stw481x->map); + dev_err(&client->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } ret = stw481x_startup(stw481x); if (ret) { -- cgit v1.2.3-18-g5258