diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-16 19:41:41 -0300 |
---|---|---|
committer | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-16 19:41:41 -0300 |
commit | cc0aa5814afde42420daf7a9c2ced54509561653 (patch) | |
tree | 68e37d290ff45f8b69da90a3720f038b8e29d0ed /linux/drivers/media/dvb | |
parent | ba213cd103289d2fcbf4c67079db98faad9e6f50 (diff) | |
download | mediapointer-dvb-s2-cc0aa5814afde42420daf7a9c2ced54509561653.tar.gz mediapointer-dvb-s2-cc0aa5814afde42420daf7a9c2ced54509561653.tar.bz2 |
Fix possible dvb-pll oops
From: Andrew de Quincey <adq_dvb@lidskialf.net>
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>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/frontends/dvb-pll.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index fce5c4252..4c8a50647 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/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) |