Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp874212pxk; Thu, 17 Sep 2020 19:58:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFi9Zcl/dqzTGHobuzQDGW7UDUPRfq9Uekt+KJWtrEEWgmqq9RWgbJWq/tpCftNFKRqDyg X-Received: by 2002:a17:906:e24d:: with SMTP id gq13mr32557492ejb.152.1600397904924; Thu, 17 Sep 2020 19:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600397904; cv=none; d=google.com; s=arc-20160816; b=aqn04zB6IzjXHdmZ8pY4hD5LanCeuV+y8wBtM5IUk06tcr35aPOThKAZys6Txo/56h IXsME8h6/Yv5SJz4FnndrYqM8T4aIVrSskwYjCKyHFURdSMya/m4EmvBLgXbr6MjgDN4 FmiyP+o0R2UHSCpyd6dO00I9jzSE6cW9/eOAtoiMD28iQk2CHvsyJDJN4ja4BWbwch+6 kZcn270X5GlaYk542FlajrulwH5Og+7MHMbCBoSRlDhmF7GoGxAxCASwdbjv9s+Zst/O 0TX3VLXFvJT/p1TUlg2N8f+4VjbKtI9b9Ew1PfqmKLrXKCI0FFl1LudIw7BMyWZq8c/Z q30g== 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=sYOsURNGFXkaWbqg3gxY8KY4uRX+Y2FuLitf+E+nWtk=; b=HVrWmwOqM8nU2Jjtko7W7YzmNmTcgm3b2DI1nL7KReD0FU2hdxggcHNxbUOcc7sUUC KnctZJHzjF59dmLzVpBOZzRPOZqzN1EP7m7bD3YNfUq05TdJhD4kKuYY+ScpulkDETxY nuM74LfLgKXMMhlrhZ1GncjhdLJ8LznPZaPGw05UhGrh9kbzR59kdE3aoZjZGHQWtOeN 2y5HRb2GKEbvXDLWb/pUaPttcNvNjixJeAQlzyt5qONERruPh1Z/RiNiPZv+gVQtEGNn x+/pYt5L1IEGIXE2CnOiy+/1Jqr3TxCcPjAcrkZwokccue/jZZ4kQH9AX3GA5EGw4Od7 /7Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YuA0cmHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1174986eja.287.2020.09.17.19.58.01; Thu, 17 Sep 2020 19:58:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YuA0cmHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729726AbgIRC4C (ORCPT + 99 others); Thu, 17 Sep 2020 22:56:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727842AbgIRCHH (ORCPT ); Thu, 17 Sep 2020 22:07:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 128D7239CF; Fri, 18 Sep 2020 02:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394814; bh=Jg+6TwgAWXviOlKsmYzEwoezFhaIclK4BFTTFerb4NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YuA0cmHbq5hDqTQ0EF6qS4q2kbexznr+owfsJFblyvm5zJ+lQkvvHn5uUXExRW9I8 vxNrYh7FHtRmvVcmLJ+B0oP4xzBVYrHRJ663ZciU0TnXR7YzrEvzCmhN5kS2kI/8mS z05mGXPXzjL2FUbdzGoRXjCcAcAe5Ks7Zq46/W+8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Ben Skeggs , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 281/330] drm/nouveau/debugfs: fix runtime pm imbalance on error Date: Thu, 17 Sep 2020 22:00:21 -0400 Message-Id: <20200918020110.2063155-281-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) -- 2.25.1