OSDN Git Service

media: i2c: tda1997x: prevent potential NULL pointer access
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 9 Aug 2019 16:52:15 +0000 (13:52 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 13 Aug 2019 14:46:32 +0000 (11:46 -0300)
commit2f822f1da08ac5c93e351e79d22920f08fa51baf
treecad46048e7a01089eb5f1ca726fe1bb4077f81cf
parent53f5d7a46fab01f22a2b4ffed8bd05aa425aed2f
media: i2c: tda1997x: prevent potential NULL pointer access

i2c_new_dummy() can fail returning a NULL pointer. This is not checked
and the returned pointer is blindly used. Convert to
devm_i2c_new_dummy_client() which returns an ERR_PTR and also add a
validity check. Using devm_* here also fixes a leak because the dummy
client was not released in the probe error path.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/tda1997x.c