summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/fan53555.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-09-18 15:49:38 +0200
committerMark Brown <broonie@kernel.org>2014-09-18 20:01:10 +0200
commite13426bf249b4928ad914c9ddf7f8b7e5a93e1c6 (patch)
treea0e0c2df9c4ec02eeb030751dbc59b0ff9d5725b /drivers/regulator/fan53555.c
parentregulator: fan53555: Fixup report wrong vendor message (diff)
downloadlinux-e13426bf249b4928ad914c9ddf7f8b7e5a93e1c6.tar.xz
linux-e13426bf249b4928ad914c9ddf7f8b7e5a93e1c6.zip
regulator: fan53555: Fix null pointer dereference
Set di->regulator before dereference it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/fan53555.c')
-rw-r--r--drivers/regulator/fan53555.c2
1 files changed, 1 insertions, 1 deletions
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);