summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb/dvb-usb-init.c
diff options
context:
space:
mode:
authorDongliang Mu <mudongliangabcd@gmail.com>2021-06-21 07:07:28 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-07-22 08:23:15 +0200
commit131ae388b88e3daf4cb0721ed4b4cb8bfc201465 (patch)
tree7a29c3ad60f03c76fb0efc2a3d4a3682c7d64add /drivers/media/usb/dvb-usb/dvb-usb-init.c
parent797c061ad715a9a1480eb73f44b6939fbe3209ed (diff)
media: dvb-usb: Fix error handling in dvb_usb_i2c_init
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>
Diffstat (limited to 'drivers/media/usb/dvb-usb/dvb-usb-init.c')
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb-init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
index 28e1fd64dd3c..61439c8f33ca 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
@@ -194,8 +194,8 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
err_adapter_init:
dvb_usb_adapter_exit(d);
-err_i2c_init:
dvb_usb_i2c_exit(d);
+err_i2c_init:
if (d->priv && d->props.priv_destroy)
d->props.priv_destroy(d);
err_priv_init: