提交 ee58cb2b 编写于 作者: W Wolfram Sang 提交者: Greg Kroah-Hartman

Staging: iio: adc: fix dangling pointers

Fix I2C-drivers which missed setting clientdata to NULL before freeing the
structure it points to. Also fix drivers which do this _after_ the structure
was freed already.
Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
Acked-by: NJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 b36fc07d
......@@ -557,6 +557,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
if (!IS_ERR(st->reg))
regulator_put(st->reg);
error_free_st:
i2c_set_clientdata(client, NULL);
kfree(st);
error_ret:
......@@ -574,6 +575,7 @@ static int max1363_remove(struct i2c_client *client)
regulator_disable(st->reg);
regulator_put(st->reg);
}
i2c_set_clientdata(client, NULL);
kfree(st);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册