Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2056102rdb; Tue, 3 Oct 2023 08:58:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOSVLQ9zjXNN9gix0+LQkyxcMN7aWKzxa7GNejj+Ube8APMrRH1qa0AmF0Dd/ukTIAIfJG X-Received: by 2002:a05:6358:41a7:b0:142:d04e:59f0 with SMTP id w39-20020a05635841a700b00142d04e59f0mr16497779rwc.14.1696348731411; Tue, 03 Oct 2023 08:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696348731; cv=none; d=google.com; s=arc-20160816; b=CcQfWzVI//w9NulacazlHlhxF3LNpHK/gsBrQvtywNsBCQJ/gJM37BdY+K2O3k5pJD 7tkUgpJtElPFsPVdlkh8oJqtIe0Uagd1P4AX+15fdmHABlTe1eHpKcs05XRFRrSkMGv+ tKLcbzK6MfeKOhbi/CrPifQFpkrwaQ16AswZ0Njd3wPI1qoDKpClbsZ9pHNoG0Rhnzbu aP94bOMTJDU6MlIjsErgi9u6tlk87rVrG4w6ZHTWuToS/Ct9bBOq4e1pHAqYe84GVaum rac5E69nMzVzxo7Zfx4UKVjecNhlWSq3KMWpbD1ta1VzdzLU3148DCTzxk6FQnb2tM78 xpzQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z3DJyASy7L9cFeDzxCeIWpKtfaYMv41uiTYkXODipSY=; fh=A7ESGAPW6WV+DCQVqmR+9L9s97lYo7gbF/gPHfKJi14=; b=BLURb1MT5Y5HtL9HOLtqoCHrf4TGckBc9a1EEHCZyNTIxCyMvdq/hpOzUnLdNf8Jz2 CZyfIWnllQGfXfoRZGkU3oJlmM/ZIyH/itZvrkhIguydWUuYtyrZECcrnarW1kC6guKJ utNSAwRLml35WotfBhmlIY+vJJHaAhZCMvr1x5WIh3+55A6V9cul50XpJZqjuZZHwTMl IXOcw9+PAK0OA+6LHBjg8uKr7ovTkoUxTI5Jk8b4nWwdPAjrLiz/LFC+/4ri9MSWcMt7 qS+v27bCG65n0/yRVib7VFBfU0d30W7md7ECopq1cxK1DUm24b3/76Haooj+jGAk9ATE zomw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUz7+KZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l63-20020a638842000000b00578c3b7af9fsi1686610pgd.184.2023.10.03.08.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUz7+KZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7A89D81A335E; Tue, 3 Oct 2023 08:58:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240153AbjJCP6s (ORCPT + 99 others); Tue, 3 Oct 2023 11:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239331AbjJCP6g (ORCPT ); Tue, 3 Oct 2023 11:58:36 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB612AB; Tue, 3 Oct 2023 08:58:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D2BFC433BD; Tue, 3 Oct 2023 15:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696348711; bh=h+DtSnVBP12aetOuLOGx+i6/WHFgyH0QPlUwjV6ftMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUz7+KZRCFoct/l8nCvYjB+m1leRF8k2uFxAv9aS8+cjm+ezua3LvXgehxXstGf19 4oACJyyU6uy686EARKf5HTrjnLfIQqQ/ooGQtzFifd8W+samAb5P+kKTHlyYCbudii Mgr+dBJ8vPlLyDG2ZGFIxMawrrHYGG/IyZdE09FNuWGuDqdqyHqEmjGq2MWaTnVOjR E7SJWTugAiK6E9Fk55AwjOI15o9iQPiapUqGvlH03Zffvp64LoHReV/JMwv9G5PRiH lzMxsoRLsWJXlSD3XD/BjhsBgxYQzXBfGBz0+mkX/HRkKPWV61c87HbO/Y+LJV3ofL btdrCu7/n7t+w== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qnhnG-000752-1H; Tue, 03 Oct 2023 17:58:42 +0200 From: Johan Hovold To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 7/7] ASoC: codecs: wcd938x-sdw: fix runtime PM imbalance on probe errors Date: Tue, 3 Oct 2023 17:55:58 +0200 Message-ID: <20231003155558.27079-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003155558.27079-1-johan+linaro@kernel.org> References: <20231003155558.27079-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 08:58:50 -0700 (PDT) Make sure to balance the runtime PM operations, including the disable count, on probe errors and on driver unbind. Fixes: 16572522aece ("ASoC: codecs: wcd938x-sdw: add SoundWire driver") Cc: stable@vger.kernel.org # 5.14 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd938x-sdw.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c index 1baea04480e2..a1f04010da95 100644 --- a/sound/soc/codecs/wcd938x-sdw.c +++ b/sound/soc/codecs/wcd938x-sdw.c @@ -1278,7 +1278,18 @@ static int wcd9380_probe(struct sdw_slave *pdev, pm_runtime_set_active(dev); pm_runtime_enable(dev); - return component_add(dev, &wcd938x_sdw_component_ops); + ret = component_add(dev, &wcd938x_sdw_component_ops); + if (ret) + goto err_disable_rpm; + + return 0; + +err_disable_rpm: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); + + return ret; } static int wcd9380_remove(struct sdw_slave *pdev) @@ -1287,6 +1298,10 @@ static int wcd9380_remove(struct sdw_slave *pdev) component_del(dev, &wcd938x_sdw_component_ops); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); + return 0; } -- 2.41.0