From: Axel Lin Date: Thu, 18 Sep 2014 13:49:38 +0000 (+0800) Subject: regulator: fan53555: Fix null pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e13426bf249b4928ad914c9ddf7f8b7e5a93e1c6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git regulator: fan53555: Fix null pointer dereference Set di->regulator before dereference it. Signed-off-by: Axel Lin Reviewed-by: Heiko Stuebner Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 0168106b2cf7..f8e4257aef92 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -361,6 +361,7 @@ static int fan53555_regulator_probe(struct i2c_client *client, if (!di) return -ENOMEM; + di->regulator = pdata->regulator; if (client->dev.of_node) { const struct of_device_id *match; @@ -389,7 +390,6 @@ static int fan53555_regulator_probe(struct i2c_client *client, return PTR_ERR(di->regmap); } di->dev = &client->dev; - di->regulator = pdata->regulator; i2c_set_clientdata(client, di); /* Get chip ID */ ret = regmap_read(di->regmap, FAN53555_ID1, &val);