From patchwork Fri Jun 17 11:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 12885592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE826C43334 for ; Fri, 17 Jun 2022 11:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KMicn0r2jo3oC7sr4QhiGm+nhfadnLeaBuDgp7X4VHA=; b=dXbTtpp23xeGTl EFXJEgJiS4tB64CvdYnrirT+OT7FhvGAr3mG37wYRLPLaH5B7ehejDFUqAwgLRYsmURlHsFeOfINW CVP1D9C6iL1MgHJNk29UWhTLVinJtpgItK0oKrkHH1VWzEpKlZod2fqh2u3FeuAnFIXAYL263a0/I XtlscJicvmzNPdcYPTYDFPhatzB/PCmZ9vUxthAWOmh4P0KBIcHP/ORp9ZDtEM+KwnxEiVgem9ntd u1rjALc+ozdyNJfOBc1mWFscBYMLxRcfZFI37mf44WJ7gR4kt3KDcSfRfhhzVQZEGGEChlmpSV8aN XF3jcjpVeI6wtanLUAxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o29vu-007FSU-0W; Fri, 17 Jun 2022 11:14:35 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o29tT-007EQ5-Bd for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 11:12:07 +0000 Received: by mail-pl1-x630.google.com with SMTP id m14so3608484plg.5 for ; Fri, 17 Jun 2022 04:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oQLjYSyO5bnT1k2cMo+qtFEL9roIKTpXUxzFJ5E7YeU=; b=WEXQJ2c0zXPPo70AqX4ePE2lo2jfTA7rpG+C5RBXENB1K0P1BBjGTUBKWrVNIRgYMx HldHvQtAl/hTE2t7F2GKPeB/yiddMus1F8uOtTiwN9+rR9c0CSzHVt8S5NTgrhhhnsSe xRiJJZNKdeC7o73Bc1I3uTPEccX3CTIDbP26E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oQLjYSyO5bnT1k2cMo+qtFEL9roIKTpXUxzFJ5E7YeU=; b=VOfl02o4YdKDd+OMUV7SuccdkWsw0G3ITxoqcaQZmqZD/fWUV40rVRAMWhcTLg3cCD pJ+Vv9QFwNX3kRyG9zf4FT8sqXXNfZAW9rsW/2NyuldE5NVS4n78kQjfrvreclP/KYjd fjDmmXpJ8M8kUdG9/BRmKeRogTwmCdniaWws+PLh26rKhDPwW5SflDAU3QCH6nUVRicY UWid8s+pkAgfnopHEQs12ZLcFcS0aOnIOol8+TnhKghadTa6lD2GDVdFXl/pP8CvOOm+ OM3g/x/y0ELVPqXdYNhWTGlOGZm/3z5+HwHyu5OO1EMCfX9cTNwE76mypaZXk0o/t+Uy sMiw== X-Gm-Message-State: AJIora+joBzHtvDusoPwpTp15Aihd+YC32laZszYVK9z5p1Zz7H1H5wR op8F8K73S2FmQy9TRaYxv/k5Jg== X-Google-Smtp-Source: AGRyM1tf2bQGeUv5328p9BV+crG8b7G31H6qrJWwNOzsEDjIHBFrwQCM7E2x9VN5sMfX6/KCSapUnw== X-Received: by 2002:a17:903:32c4:b0:167:6e6f:204b with SMTP id i4-20020a17090332c400b001676e6f204bmr9221820plr.117.1655464315709; Fri, 17 Jun 2022 04:11:55 -0700 (PDT) Received: from fshao-glinux.tpe.corp.google.com ([2401:fa00:1:10:e616:b34a:9b5b:24ef]) by smtp.gmail.com with ESMTPSA id 9-20020a170902c20900b00163f7935772sm3296754pll.46.2022.06.17.04.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 04:11:55 -0700 (PDT) From: Fei Shao To: Mark Brown , Jiaxin Yu Cc: Fei Shao , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2] ASoC: mediatek: mt8186: Fix mutex double unlock in GPIO request Date: Fri, 17 Jun 2022 19:10:04 +0800 Message-Id: <20220617111003.2014395-1-fshao@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_041203_561777_E32DAACD X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The lockdep mechanism revealed an unbalanced unlocking on MT8186: [ 2.993966] WARNING: bad unlock balance detected! [ 2.993978] ------------------------------------- [ 2.993983] kworker/u16:1/10 is trying to release lock (gpio_request_mutex) at: [ 2.993994] [] mt8186_afe_gpio_request+0xf8/0x210 [ 2.994012] but there are no more locks to release! The cause is that the mutex will be double unlocked if dai is unknown during GPIO selection, and this patch fixes it. Fixes: cfa9a966f12a ("ASoC: mediatek: mt8186: support gpio control in platform driver") Signed-off-by: Fei Shao --- Changes in v2: - Trimmed the commit message sound/soc/mediatek/mt8186/mt8186-afe-gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-gpio.c b/sound/soc/mediatek/mt8186/mt8186-afe-gpio.c index 255ffba637d3..274c0c8ec2f2 100644 --- a/sound/soc/mediatek/mt8186/mt8186-afe-gpio.c +++ b/sound/soc/mediatek/mt8186/mt8186-afe-gpio.c @@ -230,7 +230,6 @@ int mt8186_afe_gpio_request(struct device *dev, bool enable, sel = enable ? MT8186_AFE_GPIO_PCM_ON : MT8186_AFE_GPIO_PCM_OFF; break; default: - mutex_unlock(&gpio_request_mutex); dev_err(dev, "%s(), invalid dai %d\n", __func__, dai); goto unlock; }