diff mbox

[PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()).

Message ID alpine.LNX.2.00.1101021948100.11481@swampdragon.chaosbits.net (mailing list archive)
State Superseded
Headers show

Commit Message

Jesper Juhl Jan. 2, 2011, 6:49 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c
index 55f2eba..15806e5 100644
--- a/drivers/media/dvb/frontends/ix2505v.c
+++ b/drivers/media/dvb/frontends/ix2505v.c
@@ -271,7 +271,7 @@  struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 				    const struct ix2505v_config *config,
 				    struct i2c_adapter *i2c)
 {
-	struct ix2505v_state *state = NULL;
+	struct ix2505v_state *state;
 	int ret;
 
 	if (NULL == config) {
@@ -285,6 +285,7 @@  struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 
 	state->config = config;
 	state->i2c = i2c;
+	fe->tuner_priv = state;
 
 	if (state->config->tuner_write_only) {
 		if (fe->ops.i2c_gate_ctrl)
@@ -301,8 +302,6 @@  struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 			fe->ops.i2c_gate_ctrl(fe, 0);
 	}
 
-	fe->tuner_priv = state;
-
 	memcpy(&fe->ops.tuner_ops, &ix2505v_tuner_ops,
 		sizeof(struct dvb_tuner_ops));
 	deb_i2c("%s: initialization (%s addr=0x%02x) ok\n",