From patchwork Fri Oct 4 14:48:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Alves X-Patchwork-Id: 2988991 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 86D699F289 for ; Fri, 4 Oct 2013 14:48:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6F8A202FE for ; Fri, 4 Oct 2013 14:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C06E0202F9 for ; Fri, 4 Oct 2013 14:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754476Ab3JDOsd (ORCPT ); Fri, 4 Oct 2013 10:48:33 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:41515 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754224Ab3JDOsc (ORCPT ); Fri, 4 Oct 2013 10:48:32 -0400 Received: by mail-we0-f171.google.com with SMTP id p61so4745635wes.30 for ; Fri, 04 Oct 2013 07:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=9UGd0PpeSN9fYjCfg/ahJbC7aWuADl0aejnYlZzu1KM=; b=KRQ4vLuShiOLEZo9YfmwkaoAKY4eAOos8+bKaBjjldKPj2QYzTexOpl/79JeZLaSKu h/6yI66OpQoNIQkH/OYTN5w3AAhqKL8qw6xiC4DwZcUNGaUv1DlX2JyaMv6Yw4/kjCgC HclfDiWhTgGbkBx/WSeZF/zn1A7C0EeY1XrgxB2CW+tL+io3UHYFHl20Zfso5M0s7uDV 0WiXR/zPUvxsCaTYZk3o3zVKt7rBnkIGPmztVNcSueieMhmBCUSQQyTDwOxQzg2+W3b1 7QOU3UdIjiyz4+Lqmgw4N8/f9HCaVTSBj60oSVy7ME5JmLqyYvbDfzcC7fJoW64mj+p/ ptlQ== X-Received: by 10.180.211.206 with SMTP id ne14mr7917948wic.30.1380898110853; Fri, 04 Oct 2013 07:48:30 -0700 (PDT) Received: from localhost.localdomain (a89-152-209-152.cpe.netcabo.pt. [89.152.209.152]) by mx.google.com with ESMTPSA id jf2sm10698865wic.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 07:48:30 -0700 (PDT) From: Luis Alves To: linux-media@vger.kernel.org Cc: mkrufky@linuxtv.org, crope@iki.fi, mchehab@infradead.org, Luis Alves Subject: [PATCH] cx24117: Prevent mutex to be stuck on locked state if FE init fails. Date: Fri, 4 Oct 2013 15:48:35 +0100 Message-Id: <1380898115-30071-1-git-send-email-ljalvs@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Hi, This patch will fix the situation where the mutex was left in a locked state if for some reason the FE init failed. Regards, Luis Signed-off-by: Luis Alves Reviewed-by: Antti Palosaari --- drivers/media/dvb-frontends/cx24117.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c index 9087309..476b422 100644 --- a/drivers/media/dvb-frontends/cx24117.c +++ b/drivers/media/dvb-frontends/cx24117.c @@ -1238,11 +1238,11 @@ static int cx24117_initfe(struct dvb_frontend *fe) cmd.len = 3; ret = cx24117_cmd_execute_nolock(fe, &cmd); if (ret != 0) - return ret; + goto exit; ret = cx24117_diseqc_init(fe); if (ret != 0) - return ret; + goto exit; /* CMD 3C */ cmd.args[0] = 0x3c; @@ -1252,7 +1252,7 @@ static int cx24117_initfe(struct dvb_frontend *fe) cmd.len = 4; ret = cx24117_cmd_execute_nolock(fe, &cmd); if (ret != 0) - return ret; + goto exit; /* CMD 34 */ cmd.args[0] = 0x34; @@ -1260,9 +1260,8 @@ static int cx24117_initfe(struct dvb_frontend *fe) cmd.args[2] = CX24117_OCC; cmd.len = 3; ret = cx24117_cmd_execute_nolock(fe, &cmd); - if (ret != 0) - return ret; +exit: mutex_unlock(&state->priv->fe_lock); return ret;