Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp874198pxk; Thu, 17 Sep 2020 19:58:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTmMAox+UolnYp7eiIZgr+mDrzT6FK9TDEvApviVccNJBvxFQwbg+ZD81WhDPzkd8QYYc/ X-Received: by 2002:a17:906:f150:: with SMTP id gw16mr32110097ejb.528.1600397903700; Thu, 17 Sep 2020 19:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600397903; cv=none; d=google.com; s=arc-20160816; b=R9h2UOZdqaQe1M6zPWCOGm4O2JCXjpdpP1xbxJvYYmNMrd5GJ/GX+kux7bIaFLqPuL A4YKaWCds13aUqsjIrJKzV5swXH9XuklgsiOSFxxc7UMYnB2aJPIdit3WVFcdf+IL/fp 8gi47LB0MGRH8Zi8b+hvbjtCRQsm/gtf/Nc8AHPscDDmRutC5T35oPImrA9dfFEbCv6V uqDWV6PgGBQdg6HUUU918swqEhKg1bTk39DfgyCvmaLzuCHScKWbj/G4mpLoS6DOLMac YhV4l2v2NaQa9Dbu3QdoKNP1+x0zgYYif3KCrljeBj9+drT+9OgsVQO7yjV9MQGra2BA wR9Q== 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=RHME+6KSbfLNq2p9VxrxRwYWEMpufi4HQXgWd6xwesU=; b=g8iXfKjc0asTVnIvxJE/5+PwD2FH220sv7MIYZxkhp26LYf4+29937wbZTk/tKMAup +c2CRKDjzcZbJEeywAfvqFdja/VoxW8jnXNBDOE19j4y0flRisN5BtnH/Vk1AjbJt1be PczfZ/mHurcvdse66X62rGo0uLXv4KdaikaYByDF5Farl7eFuFv/vNqNsC+2Jk3kFkJh hS+rWrvPQaXJj2k+Oxz5GPK7vmbXcc4w72MZNLIN+s7lTd+mA/dwqHgcA96d0fG1AOhM xKazZskSkEt8kHel6Yj3eukW2zcHPuVhALSVGFUAZuYOba8oNe08yUHxjnLy4MsahZKp e5Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pAuwpv9A; 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 mh15si1263325ejb.389.2020.09.17.19.58.00; Thu, 17 Sep 2020 19:58:23 -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=pAuwpv9A; 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 S1729138AbgIRC4G (ORCPT + 99 others); Thu, 17 Sep 2020 22:56:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:56486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbgIRCHI (ORCPT ); Thu, 17 Sep 2020 22:07:08 -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 33B8F238A1; Fri, 18 Sep 2020 02:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394815; bh=nQMlUgA5ip2ealbwyMbqTZUXyZAbiQSbCXBtW4ps8ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAuwpv9ANh9mbckczcwZ2m/V/CdZv7JyoirBIh7RzcNJaXt1ZS5bCMCA1ksBMZsYc ScyNYmHaXEgS2IkuBuquHXkyY3RDlhY1ASJMjJe2BnlC8nHS8aojSM0cWRjajet8N0 fRJb+msZFtdvpaL1Y/LXpnGuqDki7UXKkkaHov2w= 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 282/330] drm/nouveau: fix runtime pm imbalance on error Date: Thu, 17 Sep 2020 22:00:22 -0400 Message-Id: <20200918020110.2063155-282-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 d7372dfb3f7f1602b87e0663e8b8646da23ebca7 ] 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_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index fbfe254227740..7d39d4949ee77 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -78,8 +78,10 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv) return ret; ret = pm_runtime_get_sync(dev); - if (ret < 0 && ret != -EACCES) + if (ret < 0 && ret != -EACCES) { + pm_runtime_put_autosuspend(dev); goto out; + } ret = nouveau_vma_new(nvbo, vmm, &vma); pm_runtime_mark_last_busy(dev); -- 2.25.1