]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] c8sectpfe: Combine three checks into a single if block
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 5 Nov 2015 18:23:50 +0000 (16:23 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 19 Nov 2015 12:10:22 +0000 (10:10 -0200)
The variable "tsin" was checked three times in a loop iteration of the
c8sectpfe_tuner_unregister_frontend() function.
This implementation detail could be improved by the combination of the
involved statements into a single if block so that this variable will be
checked only once there.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c

index 07fd6d9ee53ab9e4560573da23e46c49c0b11aab..2dfbe8ab521435cc0d54915feb40e012ed2d8caf 100644 (file)
@@ -209,17 +209,18 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe,
 
                tsin = fei->channel_data[n];
 
-               if (tsin && tsin->frontend) {
-                       dvb_unregister_frontend(tsin->frontend);
-                       dvb_frontend_detach(tsin->frontend);
-               }
+               if (tsin) {
+                       if (tsin->frontend) {
+                               dvb_unregister_frontend(tsin->frontend);
+                               dvb_frontend_detach(tsin->frontend);
+                       }
 
-               if (tsin)
                        i2c_put_adapter(tsin->i2c_adapter);
 
-               if (tsin && tsin->i2c_client) {
-                       module_put(tsin->i2c_client->dev.driver->owner);
-                       i2c_unregister_device(tsin->i2c_client);
+                       if (tsin->i2c_client) {
+                               module_put(tsin->i2c_client->dev.driver->owner);
+                               i2c_unregister_device(tsin->i2c_client);
+                       }
                }
        }