Skip to content

Commit

Permalink
mfd: stw481x: Check the return value of devm_regmap_init_i2c
Browse files Browse the repository at this point in the history
devm_regmap_init_i2c can fail. Check for it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Sachin Kamat authored and Lee Jones committed Mar 19, 2014
1 parent e2f3e9b commit c88fd91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/mfd/stw481x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c88fd91

Please sign in to comment.