Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp680984pxm; Wed, 2 Mar 2022 06:30:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzZ6IkkS4S8jVuHGzpSsPehHciwWmibro6CSFJ1t5he7hPqys3bbdDoxoPb1vliJ2ME6r5 X-Received: by 2002:a17:906:9f23:b0:6d6:e3c8:2abc with SMTP id fy35-20020a1709069f2300b006d6e3c82abcmr6946542ejc.742.1646231428353; Wed, 02 Mar 2022 06:30:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646231428; cv=none; d=google.com; s=arc-20160816; b=zUjspxIJosVGHZslfn/fulJyIibeq+RpIsltT+iuCriWhG9Ig4DEVcRmXGto9S0X4x znQmVyp7NG/KwbRkU+Yv/6W1/kNYdPpWbb8QmDfnCXyX1yYLjzcewNCSUeDkSSH7NtFz 6jHjLUrApyqsfqbq5oHRKA5hBm0CupI1WG4AGKH71n/3hq85Hk2LDZBMhRaf+cV5xmQH 4Pr6jdR1w2Tm0QU8nPByB1aOsvmNhkrC+1/8sz7PvbOShaQICgFItYekC4RGrjqFPsYE t8QDF1c0oSuWp3BfxbsNDrnJs3MZEnRk2rRlDXWzM/s8e4RMkm/4xAM4iITdTthNCEGD dGDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=0UqB3yDUtjR1RM9tw+84pX8CfDY4K3FJ3p+AZkVtHJw=; b=R2vPpSTG9ux+raNGkgvbvBN3KX0tsioX7XM0bz96x10AUuKr9ntvIb3+VNX8rVIuyN Jlige49XLDrsAWau7vpA1iKa3AT54fOL3DUXCcsDqT4Kpe3XoCgKcokc3OW+rPS7lKkF FVUYizrDvj5Ovov2+FkGC+n0A/R87LfD9LvS4LuQ0CnORmIM9elNu8TgPeOcdY2IjV5c FfWTD+VrJuiMiuL/ttONbRdc5neebsCW9iNHR6WsANzUrTm9keyGypjOlEtLYam5PN1O pnWoXik3Xqfyq2JaVh8qdhk75P7b+/BfK2pvaxGQxg+R9Es61AixlZsiHvTdvcD+f1FC UOMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=OFrJHNio; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a17090676c800b006d6dc18c2fdsi3997107ejn.643.2022.03.02.06.30.05; Wed, 02 Mar 2022 06:30:28 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=OFrJHNio; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229979AbiCBKFB (ORCPT + 99 others); Wed, 2 Mar 2022 05:05:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238673AbiCBKEx (ORCPT ); Wed, 2 Mar 2022 05:04:53 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7010A60068 for ; Wed, 2 Mar 2022 02:04:07 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2F4CD21997; Wed, 2 Mar 2022 10:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646215446; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0UqB3yDUtjR1RM9tw+84pX8CfDY4K3FJ3p+AZkVtHJw=; b=OFrJHNio1gs2aReQXoKhtYER9CyLiQLvXcosjdppD578PgPQLJ5OVIAUW0k4fTUXfUZ88F FkJiSxBEkBEhXmMpGbB3qdKIFTNo3wUFZRvwuOzVvrP50/78POMr5BqArrX7ALWcPecPfv ZAqMsATANAKOci4Ig7PUqjUuPqZ7Twk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646215446; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0UqB3yDUtjR1RM9tw+84pX8CfDY4K3FJ3p+AZkVtHJw=; b=rxG6Eeqk8qJgRMuMlO6TS6CvYCBT+ne+bR7jsooRnBZqeM0dwf+FmKP4TqQZ2dY3kXM5PI kaM6J0WWhz5BorBg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 22A91A3B81; Wed, 2 Mar 2022 10:04:06 +0000 (UTC) Date: Wed, 02 Mar 2022 11:04:06 +0100 Message-ID: From: Takashi Iwai To: Zhen Ni Cc: frattaroli.nicolas@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error In-Reply-To: <20220302100019.22891-1-nizhen@uniontech.com> References: <20220302100019.22891-1-nizhen@uniontech.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 02 Mar 2022 11:00:19 +0100, Zhen Ni wrote: > > pm_runtime_get_sync() increments the runtime PM usage counter even the > call returns an error code. Thus a pairing decrement is needed on the > error handling path to keep the counter balanced. > > Signed-off-by: Zhen Ni Better to use a new function pm_runtime_resume_and_get(). thanks, Takashi > --- > sound/soc/rockchip/rockchip_i2s_tdm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c > index 5f9cb5c4c7f0..4691a76b499d 100644 > --- a/sound/soc/rockchip/rockchip_i2s_tdm.c > +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c > @@ -1739,8 +1739,10 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev) > int ret; > > ret = pm_runtime_get_sync(dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put(dev); > return ret; > + } > ret = regcache_sync(i2s_tdm->regmap); > pm_runtime_put(dev); > > -- > 2.20.1 > > >