]> err.no Git - linux-2.6/blobdiff - drivers/media/dvb/frontends/dvb-pll.c
V4L/DVB (4311): Fix possible dvb-pll oops
[linux-2.6] / drivers / media / dvb / frontends / dvb-pll.c
index fce5c425225242cf3c16d232c5f39e4799a1e1fe..4c8a506479b4f1eb7dc11a8eb5be306b2f13559b 100644 (file)
@@ -619,14 +619,16 @@ int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2
        struct dvb_pll_priv *priv = NULL;
        int ret;
 
-       if (fe->ops.i2c_gate_ctrl)
-               fe->ops.i2c_gate_ctrl(fe, 1);
-
-       ret = i2c_transfer (i2c, msg, 2);
-       if (ret != 2)
-               return -1;
-       if (fe->ops.i2c_gate_ctrl)
-                    fe->ops.i2c_gate_ctrl(fe, 0);
+       if (i2c != NULL) {
+               if (fe->ops.i2c_gate_ctrl)
+                       fe->ops.i2c_gate_ctrl(fe, 1);
+
+               ret = i2c_transfer (i2c, msg, 2);
+               if (ret != 2)
+                       return -1;
+               if (fe->ops.i2c_gate_ctrl)
+                            fe->ops.i2c_gate_ctrl(fe, 0);
+       }
 
        priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL);
        if (priv == NULL)