summaryrefslogtreecommitdiff
path: root/drivers/media/tuners/e4000.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-09-22 19:32:27 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-27 22:17:44 +0400
commit36f647bad3d35546892c3639328479355da8690d (patch)
tree83686bc568439250376bd79998cb118ba3d9689c /drivers/media/tuners/e4000.c
parentef40c0088ecbc8863c9404c96065269c83c16259 (diff)
downloadlinux-36f647bad3d35546892c3639328479355da8690d.tar.xz
[media] e4000: fix crash when attach fails
Callbacks were set even attach failed. This leads calling .release() in error case and resulted crash. Reported-by: Oliver Schinagl <oliver@schinagl.nl> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/tuners/e4000.c')
-rw-r--r--drivers/media/tuners/e4000.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index ffaa4824d6af..1b33ed368abe 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -366,9 +366,6 @@ struct dvb_frontend *e4000_attach(struct dvb_frontend *fe,
priv->cfg = cfg;
priv->i2c = i2c;
- fe->tuner_priv = priv;
- memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops,
- sizeof(struct dvb_tuner_ops));
/* check if the tuner is there */
ret = e4000_rd_reg(priv, 0x02, &chip_id);
@@ -389,6 +386,10 @@ struct dvb_frontend *e4000_attach(struct dvb_frontend *fe,
"%s: Elonics E4000 successfully identified\n",
KBUILD_MODNAME);
+ fe->tuner_priv = priv;
+ memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops,
+ sizeof(struct dvb_tuner_ops));
+
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);