]> git.baikalelectronics.ru Git - kernel.git/commit
media: dvb-usb: Fix error handling in dvb_usb_i2c_init
authorDongliang Mu <mudongliangabcd@gmail.com>
Mon, 21 Jun 2021 05:07:28 +0000 (07:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:47:31 +0000 (09:47 +0200)
commitb1cc6538323ce06f0d03c5c2a58d92c82af7116f
treea92f0d0dd6804cc3036c4e99442cc7dc6b1a4b03
parentf1b17c8b27883758e11757d1355037f936baed4f
media: dvb-usb: Fix error handling in dvb_usb_i2c_init

[ Upstream commit 131ae388b88e3daf4cb0721ed4b4cb8bfc201465 ]

In dvb_usb_i2c_init, if i2c_add_adapter fails, it only prints an error
message, and then continues to set DVB_USB_STATE_I2C. This affects the
logic of dvb_usb_i2c_exit, which leads to that, the deletion of i2c_adap
even if the i2c_add_adapter fails.

Fix this by returning at the failure of i2c_add_adapter and then move
dvb_usb_i2c_exit out of the error handling code of dvb_usb_i2c_init.

Fixes: 13a79f14ab28 ("media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/dvb-usb/dvb-usb-i2c.c
drivers/media/usb/dvb-usb/dvb-usb-init.c