Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1775626pxp; Mon, 7 Mar 2022 02:02:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCAWgMSkagoHlPOFmgoTOSe1xL2zJPn2YUj5RXzD6vPXgLQoBJQd/4cpWV5PCjDhqT38DB X-Received: by 2002:a62:1608:0:b0:4f6:f496:c678 with SMTP id 8-20020a621608000000b004f6f496c678mr5394371pfw.49.1646647365901; Mon, 07 Mar 2022 02:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647365; cv=none; d=google.com; s=arc-20160816; b=LNgFrqPJtBQb3Am6tvEr9rYILvpuBR9t0crnKfZkzYnA1iRLKMxNVqRnAxr3fTL9a2 pOmxhMBHmsEXMkQhJ0Ltu69/QHmhxKEXCpU1PDjRM/89pj/or+ZTIt3v1I34ppQTZHDL cLAiUXE0VCOlVL+0YftLYOrDmE83lhKoUsXQqqEkERz2owkS1h/pNGBJBCkFB9Sclob0 Gcnx/OLcwRQSlKUQtKSFM6f35+XgY/HJl0O+DVAh4sHaxIIyIaCi+Plmuu5yimu3LY26 pXLzk5Qwc7p4cNsbJ6UOe8HuwA9PDoOwmdatPdzJC7yhDoPh4iEbGOSvNdqBO8axeVSF Bjwg== 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=FX/VHatoJOi1dyjs4RTUdNGswG7A0bMK/+dEwcM6Z0I=; b=ZEUt3C2BRMZoebhYJy0CfI4K6+CGpxqUFhfzT+PzvKfzh5FRpQ4rYjOrLLMzbXOdTN Utf1SmAyFF5CYdrL1RLGpo/Q+F4PyFQHF1xgBHK7lgqhP4w9TdD/DA4cXQ/ygZ12dA6M 2MC6wmK2glHU0NQi1jULcjLW028KE1JBvCQmyv2M6f6PgR76yExPS6OWYqxQwVKD7RH6 9fyL/nLYJK4558mnFCvmv3X7D1fquCz9LRdcIZW8nLQgtCLjO/EydzFbdNwFkvV851f5 t7HtV94ROr71qO4mj5R7o6VTWZKfzdO7Y2qLULxmuB6alaKi+8oYfA14uSQD5+k/0fwe xmkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VfarMTS+; 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 y3-20020a1709027c8300b0014fdaf37566si11135322pll.180.2022.03.07.02.02.30; Mon, 07 Mar 2022 02:02:45 -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=@linuxfoundation.org header.s=korg header.b=VfarMTS+; 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 S233916AbiCGJY4 (ORCPT + 99 others); Mon, 7 Mar 2022 04:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237218AbiCGJXe (ORCPT ); Mon, 7 Mar 2022 04:23:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB34553702; Mon, 7 Mar 2022 01:22:09 -0800 (PST) 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 AE336B810C3; Mon, 7 Mar 2022 09:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21ACBC340E9; Mon, 7 Mar 2022 09:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644927; bh=z26jdcz8ETQiT0yMjJkEpAN2tFFILIDjhzcZj/5HSQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfarMTS+Rb2OMsXAMoQ6IS7KdDAZJxaPt3tYfOTUGExexJpc6vydk+24zzxFpfOPh abOoIpp+EeJsNnKfpr8RQ6+RfxwVyB08NUjD/whzFKnm//0b7RoiNmC+MvSvxpgCfE BioIQ1eeX7UUw/RB34z8vg1CCpkbCGjdoFVjLOvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yongzhi Liu , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 06/42] dmaengine: shdma: Fix runtime PM imbalance on error Date: Mon, 7 Mar 2022 10:18:40 +0100 Message-Id: <20220307091636.335953428@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.146155347@linuxfoundation.org> References: <20220307091636.146155347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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,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 From: Yongzhi Liu [ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ] pm_runtime_get_() increments the runtime PM usage counter even when it returns an error code, thus a matching decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Yongzhi Liu Link: https://lore.kernel.org/r/1642311296-87020-1-git-send-email-lyz_cs@pku.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/sh/shdma-base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c index 12fa48e380cf5..4f8dfe77da3c5 100644 --- a/drivers/dma/sh/shdma-base.c +++ b/drivers/dma/sh/shdma-base.c @@ -118,8 +118,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) ret = pm_runtime_get(schan->dev); spin_unlock_irq(&schan->chan_lock); - if (ret < 0) + if (ret < 0) { dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret); + pm_runtime_put(schan->dev); + } pm_runtime_barrier(schan->dev); -- 2.34.1