From patchwork Sun Jan 2 18:49:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 446451 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p02IoNG2025363 for ; Sun, 2 Jan 2011 18:50:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755262Ab1ABStq (ORCPT ); Sun, 2 Jan 2011 13:49:46 -0500 Received: from swampdragon.chaosbits.net ([90.184.90.115]:29342 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755228Ab1ABStk (ORCPT ); Sun, 2 Jan 2011 13:49:40 -0500 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 0432A9403D; Sun, 2 Jan 2011 19:49:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id C09309403B; Sun, 2 Jan 2011 19:49:38 +0100 (CET) Date: Sun, 2 Jan 2011 19:49:38 +0100 (CET) From: Jesper Juhl To: Malcolm Priestley cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab Subject: Re: [PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()). In-Reply-To: <1293820435.29966.59.camel@tvboxspy> Message-ID: References: <1293758374.10326.7.camel@tvboxspy> <1293820435.29966.59.camel@tvboxspy> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 02 Jan 2011 18:50:37 +0000 (UTC) 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",