[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>
This commit is contained in:
Antti Palosaari 2012-09-22 12:32:27 -03:00 committed by Mauro Carvalho Chehab
parent ef40c0088e
commit 36f647bad3
1 changed files with 4 additions and 3 deletions

View File

@ -366,9 +366,6 @@ struct dvb_frontend *e4000_attach(struct dvb_frontend *fe,
priv->cfg = cfg; priv->cfg = cfg;
priv->i2c = i2c; 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 */ /* check if the tuner is there */
ret = e4000_rd_reg(priv, 0x02, &chip_id); 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", "%s: Elonics E4000 successfully identified\n",
KBUILD_MODNAME); 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) if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); fe->ops.i2c_gate_ctrl(fe, 0);