From patchwork Tue Sep 29 11:00:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290862 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=ham 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 667F5C4727F for ; Tue, 29 Sep 2020 12:21:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 144EA2076B for ; Tue, 29 Sep 2020 12:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382093; bh=ANEvw/4pMtBeQ3ZLljniHBGPRo5wvvucV4VHXsHoqgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VyI1f4DqB2/pkKl/RVF5/uXRY3LfLvR1rNjfpt/PuKrnWdbuvJGlRJ+JfH/8WeKFU eoNB9n1Hg0PPf2b/rl4DO3Dul6gHvumjXF256WLD6Z4NAJyryRZ+Ce/vO4JFdvYyIt d4q37xhXQoh/YjYuSry2m5psgsraSQwU9zPtm6k4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732413AbgI2MVb (ORCPT ); Tue, 29 Sep 2020 08:21:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:50012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729825AbgI2LfT (ORCPT ); Tue, 29 Sep 2020 07:35:19 -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 338BF23D39; Tue, 29 Sep 2020 11:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378983; bh=ANEvw/4pMtBeQ3ZLljniHBGPRo5wvvucV4VHXsHoqgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkPKWZGL3CiaYAWtUUK8qvObNu88ngmW6LjZCkcTmG1TetRUAUJA/GbvDfaVFWCd9 Hl6oadUeuXISvYfdKBWlniQ696hCoAKbK+MvxLdpZrsiJLk0g5iDGY9CfIEyA3+4Gz u3Ix8O0MYnVNTInr+2ImyDxEqjEkgNBvdM2CYa+g= 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 4.19 171/245] drm/nouveau/debugfs: fix runtime pm imbalance on error Date: Tue, 29 Sep 2020 13:00:22 +0200 Message-Id: <20200929105955.301030104@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@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 9635704a1d864..4561a786fab07 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -161,8 +161,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)