[media] cx23885: do not unregister demod I2C client twice on error
authorAntti Palosaari <crope@iki.fi>
Wed, 10 Dec 2014 13:59:13 +0000 (10:59 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 30 Dec 2014 12:44:24 +0000 (10:44 -0200)
Demod I2C client should be NULL after demod is unregistered on error
path, otherwise it will be unregistered again when driver is unload.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-dvb.c

index c47d18270cfc8899f262be3f338329e869bb4cb2..6bb79355892c74bc8b929a2f138217f413e65e4c 100644 (file)
@@ -1793,12 +1793,14 @@ static int dvb_register(struct cx23885_tsport *port)
                                        client_tuner->dev.driver == NULL) {
                                module_put(client_demod->dev.driver->owner);
                                i2c_unregister_device(client_demod);
+                               port->i2c_client_demod = NULL;
                                goto frontend_detach;
                        }
                        if (!try_module_get(client_tuner->dev.driver->owner)) {
                                i2c_unregister_device(client_tuner);
                                module_put(client_demod->dev.driver->owner);
                                i2c_unregister_device(client_demod);
+                               port->i2c_client_demod = NULL;
                                goto frontend_detach;
                        }
                        port->i2c_client_tuner = client_tuner;
@@ -1843,12 +1845,14 @@ static int dvb_register(struct cx23885_tsport *port)
                                client_tuner->dev.driver == NULL) {
                        module_put(client_demod->dev.driver->owner);
                        i2c_unregister_device(client_demod);
+                       port->i2c_client_demod = NULL;
                        goto frontend_detach;
                }
                if (!try_module_get(client_tuner->dev.driver->owner)) {
                        i2c_unregister_device(client_tuner);
                        module_put(client_demod->dev.driver->owner);
                        i2c_unregister_device(client_demod);
+                       port->i2c_client_demod = NULL;
                        goto frontend_detach;
                }
                port->i2c_client_tuner = client_tuner;
@@ -1989,6 +1993,7 @@ static int dvb_register(struct cx23885_tsport *port)
                                client_tuner->dev.driver == NULL) {
                        module_put(client_demod->dev.driver->owner);
                        i2c_unregister_device(client_demod);
+                       port->i2c_client_demod = NULL;
                        goto frontend_detach;
                }
                if (!try_module_get(client_tuner->dev.driver->owner)) {