media: ddbridge/ci: further deduplicate code/logic in ddb_ci_attach()
authorDaniel Scheller <d.scheller@gmx.net>
Thu, 8 Feb 2018 19:53:12 +0000 (14:53 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 6 Mar 2018 13:42:59 +0000 (08:42 -0500)
Deduplicate the checks for a valid ptr in port->en, and also handle the
default case to also catch eventually yet unsupported CI hardware.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/ddbridge/ddbridge-ci.c

index 5828111487b0b3a2f6d94c2b7a7b3b6c93e26251..ed19890710d6c1e6e5ce3e32586e3d9e208c53ca 100644 (file)
@@ -325,24 +325,20 @@ int ddb_ci_attach(struct ddb_port *port, u32 bitrate)
        case DDB_CI_EXTERNAL_SONY:
                cxd_cfg.bitrate = bitrate;
                port->en = cxd2099_attach(&cxd_cfg, port, &port->i2c->adap);
-               if (!port->en)
-                       return -ENODEV;
                break;
-
        case DDB_CI_EXTERNAL_XO2:
        case DDB_CI_EXTERNAL_XO2_B:
                ci_xo2_attach(port);
-               if (!port->en)
-                       return -ENODEV;
                break;
-
        case DDB_CI_INTERNAL:
                ci_attach(port);
-               if (!port->en)
-                       return -ENODEV;
                break;
+       default:
+               return -ENODEV;
        }
 
+       if (!port->en)
+               return -ENODEV;
        dvb_ca_en50221_init(port->dvb[0].adap, port->en, 0, 1);
        return 0;
 }