summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-07-16 19:41:41 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-07-29 17:22:25 -0300
commit55c05b6d226f68266d1f88dd81795b04d096b1c8 (patch)
tree4d853db5c29dfc7b3ffb76498088ed888f46862b /drivers/media
parente61b6fc58b4a0b07f1ccfc67bf2b84a2848fcb2c (diff)
V4L/DVB (4311): Fix possible dvb-pll oops
Supplying a NULL i2c adapter to dvb_pll_attach is allowed, for example with mt352 demods. However, the pll i2c probe will segfault because it does not check for this. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index fce5c425225..4c8a506479b 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -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)