From: Antti Palosaari Date: Sun, 10 Jun 2012 00:37:11 +0000 (-0300) Subject: [media] dvb_usb_v2: I2C adapter cleanup changes X-Git-Tag: firefly_0821_release~3680^2~275^2~1668 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0fba999f13b7480278946be4b51db4a1035e7f4f;p=firefly-linux-kernel-4.4.55.git [media] dvb_usb_v2: I2C adapter cleanup changes Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c index c98712a29133..5759d8e2f8ef 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c @@ -70,10 +70,12 @@ err: int dvb_usbv2_i2c_init(struct dvb_usb_device *d) { - int ret = 0; + int ret; - if (!d->props.i2c_algo) - return 0; + if (!d->props.i2c_algo) { + ret = 0; + goto err; + } strlcpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name)); d->i2c_adap.algo = d->props.i2c_algo; @@ -83,11 +85,16 @@ int dvb_usbv2_i2c_init(struct dvb_usb_device *d) i2c_set_adapdata(&d->i2c_adap, d); ret = i2c_add_adapter(&d->i2c_adap); - if (ret < 0) - pr_err("%s: could not add i2c adapter\n", KBUILD_MODNAME); + if (ret < 0) { + pr_err("%s: i2c_add_adapter() failed\n", KBUILD_MODNAME); + goto err; + } d->state |= DVB_USB_STATE_I2C; + return 0; +err: + pr_debug("%s: failed=%d\n", __func__, ret); return ret; } @@ -95,7 +102,9 @@ int dvb_usbv2_i2c_exit(struct dvb_usb_device *d) { if (d->state & DVB_USB_STATE_I2C) i2c_del_adapter(&d->i2c_adap); + d->state &= ~DVB_USB_STATE_I2C; + return 0; }