From patchwork Tue Sep 29 11:00:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 291002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 956DCC4741F for ; Tue, 29 Sep 2020 11:59:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4AC38206DB for ; Tue, 29 Sep 2020 11:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601380775; bh=Jg+6TwgAWXviOlKsmYzEwoezFhaIclK4BFTTFerb4NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MOCI5oMB2lV4HT76ixs3fgXN5EITTBIWtosA25JJbqzo8AJOCRYXkdY0ZvEpkkn+M 2es8qDtCb7UsBRYY2z8C2/hboAIovonvNC5lpZECEu7m67yxcBp34FGIEGaP71B4Tu M0VyQGvW1CIRfTtDecLKzpSYFZVUdyKx0IpFQOn8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728319AbgI2L7H (ORCPT ); Tue, 29 Sep 2020 07:59:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729306AbgI2Ll1 (ORCPT ); Tue, 29 Sep 2020 07:41:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E323206DB; Tue, 29 Sep 2020 11:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379686; bh=Jg+6TwgAWXviOlKsmYzEwoezFhaIclK4BFTTFerb4NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tFtIHokL/IqSKflcgTVLElOhR+5ey9dfrue7w7NaSe6e+E/VGGMd5a1JSpK1Ii8s5 LeHjmREbSQFexzDFp64sXCZpmzFabdrR87mRSH8jD9+BTFtgeGf3SIQH8lvop5mmu/ asbR5kFvkEfQCQcAAuoH1Dm4DuRkNER8Oy6ggujU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Ben Skeggs , Sasha Levin Subject: [PATCH 5.4 273/388] drm/nouveau/debugfs: fix runtime pm imbalance on error Date: Tue, 29 Sep 2020 13:00:04 +0200 Message-Id: <20200929110023.677744902@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit 00583fbe8031f69bba8b0a9a861efb75fb7131af ] 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: Dinghao Liu Signed-off-by: Ben Skeggs Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 5c314f135dd10..3b13feca970f7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -183,8 +183,11 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf, } ret = pm_runtime_get_sync(drm->dev); - if (ret < 0 && ret != -EACCES) + if (ret < 0 && ret != -EACCES) { + pm_runtime_put_autosuspend(drm->dev); return ret; + } + ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args)); pm_runtime_put_autosuspend(drm->dev); if (ret < 0)