From 1f0ee65a3b6a3c78c4f6b10f8df5700a44ed3c36 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 5 Jan 2014 08:43:40 -0300 Subject: [PATCH] [media] em28xx: unregister i2c bus 0 if bus 1 fails to register MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix the error handling logic, making it to unregister i2c bus 0, in case of a failure to register the second bus. Reported-by: Frank Schäfer Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-cards.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 541de6df127b..dbce4dc421f9 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2989,6 +2989,9 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, if (retval < 0) { em28xx_errdev("%s: em28xx_i2c_register bus 1 - error [%d]!\n", __func__, retval); + + em28xx_i2c_unregister(dev, 0); + return retval; } } -- 2.30.2