提交 e13426bf 编写于 作者: A Axel Lin 提交者: Mark Brown

regulator: fan53555: Fix null pointer dereference

Set di->regulator before dereference it.
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Reviewed-by: NHeiko Stuebner <heiko@sntech.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 fe230531
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册