Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Sachin Kamat and committed by
Lee Jones
c88fd91b e2f3e9bb

+6
+6
drivers/mfd/stw481x.c
··· 186 186 i2c_set_clientdata(client, stw481x); 187 187 stw481x->client = client; 188 188 stw481x->map = devm_regmap_init_i2c(client, &stw481x_regmap_config); 189 + if (IS_ERR(stw481x->map)) { 190 + ret = PTR_ERR(stw481x->map); 191 + dev_err(&client->dev, "Failed to allocate register map: %d\n", 192 + ret); 193 + return ret; 194 + } 189 195 190 196 ret = stw481x_startup(stw481x); 191 197 if (ret) {