Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1184211rwi; Wed, 19 Oct 2022 07:38:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FL9hF6CgCc6e4z/jJPwH/KmUznkh9he+gSixjiSSg9vCPhE5AOcKzY0bP9TvrOhY+bWLu X-Received: by 2002:a05:6402:550c:b0:443:7d15:d57f with SMTP id fi12-20020a056402550c00b004437d15d57fmr7850562edb.147.1666190308402; Wed, 19 Oct 2022 07:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666190308; cv=none; d=google.com; s=arc-20160816; b=wxA4HSKnDrqPxuu2JO9rCipWSBet246WFD06HZOrm2hr87LrYOfxWPE+qT4HpTSOtQ 3Ye1UZRHbhPaxWKqYf7ucovY301Q0MIKtHt/tS+/32dH823+tGOQg1r3diwNT3NhQ7Y4 NkADGB9MytnsG+W8cfkzFpumzpC0Pfb+l7hErxrAmYCkVhZ9K+5XqqUaP+aEwn+HmWCk wpAEn1hxKBqBMFu4YaJN7GrjE9G0i/TYQLKQL0rxgRZ/5TRqyLNyYydDNoER0E91mtSA 42dSqerjHPnwUOBJjQFVxUrmTpu0bNTq/94462UgqJzL81VqN0tL4cMIjDQmSRDnGZVB 6kgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mgctZY9hovJ7vSONoeOa0q44K80Wcy4UrpkPL70jZXo=; b=kza9MF2DoaABOjeRqiWoEaKlg1f2FR5PkzlTypvLQs2j/FBhddF9/uBz1umCWXAkWq ud0MkFwaf4zTEe6AKW0JwodsTfQLJvwE8XJsK2zBlHZOo8cVvxc102Xdvxqk9msULpke dWv+Vji/qkrcD7+8SwxXxzD7QtYe2uevgtsfwEE10r8zwbvg8hK6tfwZjVowaRcuVmQd YQeVva+gH4OW6LK2RrCPsRW6hveFIiXtKtycW6M3LX7yG3aixNhXfXQx1qgXnn5czGuL XDhJHMwOFirU0ruSLP0ZpN0pZppGgtEbbgzwXkQ+qwGyt3RycahE5223jkPirorr9wPM LDiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ngoY4gRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn4-20020a0564020ca400b0045c4b1f4315si13046665edb.485.2022.10.19.07.38.02; Wed, 19 Oct 2022 07:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ngoY4gRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233394AbiJSNtq (ORCPT + 99 others); Wed, 19 Oct 2022 09:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbiJSNrl (ORCPT ); Wed, 19 Oct 2022 09:47:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2EDDDED11; Wed, 19 Oct 2022 06:32:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3791DB82433; Wed, 19 Oct 2022 08:57:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3ACFC433C1; Wed, 19 Oct 2022 08:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169869; bh=/DO/MJLKGlxxqHVavgVn6SazxotEdrvId6km3FQ0/N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngoY4gRpv1imChIHVLSGYKYSm83F9QLCJgiIH/Oye8OaGzvuuqd0YcsEcUPGioNdW Vp54NJjd9vaO14WtsM98Y/Xa3Z8thFFVIKDDriHE7fwEnS2I2HP4SshFl0MDW0r3cl Yh5yDRGoqgCwp3gvg9IZrwzPinmiJRfmX7su67xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 6.0 412/862] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Date: Wed, 19 Oct 2022 10:28:19 +0200 Message-Id: <20221019083308.168101481@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of mt6660_i2c_probe. Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-5-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c index ba11555796ad..45e0df13afb9 100644 --- a/sound/soc/codecs/mt6660.c +++ b/sound/soc/codecs/mt6660.c @@ -503,13 +503,17 @@ static int mt6660_i2c_probe(struct i2c_client *client) dev_err(chip->dev, "read chip revision fail\n"); goto probe_fail; } - pm_runtime_set_active(chip->dev); - pm_runtime_enable(chip->dev); ret = devm_snd_soc_register_component(chip->dev, &mt6660_component_driver, &mt6660_codec_dai, 1); + if (!ret) { + pm_runtime_set_active(chip->dev); + pm_runtime_enable(chip->dev); + } + return ret; + probe_fail: _mt6660_chip_power_on(chip, 0); mutex_destroy(&chip->io_lock); -- 2.35.1