Merge remote-tracking branch 'regulator/topic/core' into regulator-next
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / stw481x.c
index 1243d5c6a448568e2b1166ae34ab7e61b16e78de..7ceb3df09e25b8cda660b9307e9f23c5740433ab 100644 (file)
@@ -167,7 +167,7 @@ static struct mfd_cell stw481x_cells[] = {
        },
 };
 
-const struct regmap_config stw481x_regmap_config = {
+static const struct regmap_config stw481x_regmap_config = {
        .reg_bits = 8,
        .val_bits = 8,
 };
@@ -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) {