提交 2042f3c2 编写于 作者: C Christophe JAILLET 提交者: Lee Jones

mfd: max8998: Fix potential NULL pointer dereference

if 'max8998_i2c_parse_dt_pdata() fails (when out of memory), a NULL
pointer dereference will occur in the error handling code.

Return directly instead.

Fixes: ee999fb3("mfd: max8998: Add support for Device Tree")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 09530751
......@@ -192,10 +192,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) {
pdata = max8998_i2c_parse_dt_pdata(&i2c->dev);
if (IS_ERR(pdata)) {
ret = PTR_ERR(pdata);
goto err;
}
if (IS_ERR(pdata))
return PTR_ERR(pdata);
}
i2c_set_clientdata(i2c, max8998);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册