From patchwork Mon Mar 10 11:58:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 3802701 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47FDBBF540 for ; Mon, 10 Mar 2014 12:00:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AA312022A for ; Mon, 10 Mar 2014 12:00:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1AA4201BA for ; Mon, 10 Mar 2014 12:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753471AbaCJMAc (ORCPT ); Mon, 10 Mar 2014 08:00:32 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:50446 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbaCJL7w (ORCPT ); Mon, 10 Mar 2014 07:59:52 -0400 Received: from [201.74.152.26] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1WMys1-000540-Um; Mon, 10 Mar 2014 11:59:50 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1WMyrN-0001Qb-Gu; Mon, 10 Mar 2014 08:59:09 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH 07/15] drx-j: Fix usage of drxj_close() Date: Mon, 10 Mar 2014 08:58:59 -0300 Message-Id: <1394452747-5426-8-git-send-email-m.chehab@samsung.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1394452747-5426-1-git-send-email-m.chehab@samsung.com> References: <1394452747-5426-1-git-send-email-m.chehab@samsung.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function is currently not used. However, it was meant to be called at device release. So, add it there. While here, remove the bad check, as reported by Dan, as smatch warning: drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036) Reported-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/drx39xyj/drxj.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 828d0527f38d..c5205d5c997e 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -11510,8 +11510,7 @@ static int drxj_close(struct drx_demod_instance *demod) int rc; enum drx_power_mode power_mode = DRX_POWER_UP; - if ((demod == NULL) || - (demod->my_common_attr == NULL) || + if ((demod->my_common_attr == NULL) || (demod->my_ext_attr == NULL) || (demod->my_i2c_dev_addr == NULL) || (!demod->my_common_attr->is_opened)) { @@ -12218,6 +12217,8 @@ static void drx39xxj_release(struct dvb_frontend *fe) struct drx39xxj_state *state = fe->demodulator_priv; struct drx_demod_instance *demod = state->demod; + drxj_close(demod); + kfree(demod->my_ext_attr); kfree(demod->my_common_attr); kfree(demod->my_i2c_dev_addr);