Skip to content

Commit

Permalink
regulator: fan53555: Fix null pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
AxelLin authored and broonie committed Sep 18, 2014
1 parent fe23053 commit e13426b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/fan53555.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e13426b

Please sign in to comment.