Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp192618pxx; Wed, 28 Oct 2020 02:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3WFMNDdKmQskAHChjT47+0EiUsx9dDc2yXQwLeIKdbLQlk0ElyPRJk2IW7bTLK2K/XlQ X-Received: by 2002:a17:906:ad8:: with SMTP id z24mr6440321ejf.222.1603876665089; Wed, 28 Oct 2020 02:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876665; cv=none; d=google.com; s=arc-20160816; b=QcG/EXThqBl/xeYFl6o5p0tcBlWneLi5MO2CBwWm8dA4nQcN7P6O8cdEpfhi2+qsWk /rOBbwBBszXWUFQxuXvemsCT622kEbM67UrHKNxjOVvnp/znnVljdpFLBzHAPKSgb/0k 2366s8nHnup5RSONbmpC5Iz4lnFZRffYvOyCfwMB38MhX3up8VDgmCS6cFA64/uNuqkj 0EYuU7hgbaDhwZ3zOKERnLS7+5rRbWGe6FkNGMLS5AsZBBE/i52L3A4zGhh3fhXRDcrx uTIN3Vcx4VcQC1HrLcgcWvmDBD3OWlnfXodAzryOaa393mNTYp+QFD3CfKjsYgx8/W4x fv7Q== 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=xyttDYTSNd8QVK/0JWc6T2T6kxnCpyPmeQrhvZeN7E8=; b=XWyEzdH0fVRxX/09S3JmdKBvtOtZpclKII61+N10Qm9TrFXUqZgEv0DaP/cOktV++J pos3pLiuF2Gy5AusWCsrk4Ad0nBysl1xToZQooM+elx9bav/18K3ZMMPPXmUpd/0Y1QO s8e5/zOqlwzMlq9YraaVGy4tXJ/X9zQjAIf5pxyfj13MBbwKVoIAMPU456GFUX8xTPRa BM4Wtf5+DZeFNO5p3bfOkiLZu04xZVmMwkUzMsnW2rVH62Ec9shk6ptumZoVnDE9UVWR A+F6nxVF0qjWO5vTUm5avyNP+1Ys9XDhCzU2ES5+LWE+eGrdCA9Y1eWuJoBLtIptAduj 6Uuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f7qiiVvw; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si2879649ejg.48.2020.10.28.02.17.22; Wed, 28 Oct 2020 02:17:45 -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=f7qiiVvw; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757345AbgJ0OSt (ORCPT + 99 others); Tue, 27 Oct 2020 10:18:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508626AbgJ0OPt (ORCPT ); Tue, 27 Oct 2020 10:15:49 -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 F3B2C206F7; Tue, 27 Oct 2020 14:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808149; bh=SUR7Gbyj8a3csgddSBZj5o5uUDCX0PwdODgylVSq+jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7qiiVvwAvuag2L0F/ifv3s9B9oTyIK7jvAEWGqtJKdD7Qs0FL4bx/s4mJao6ZDcZ +B3Goh7hZbh7U4dRaM08raDtUqdJIKHBD4XlOySvO7FPk4JmOm6zAIhqsUlArpqSo9 m5e0fFQoibVVjRwp3qgv+mojurOvq/vUpGIQ5u7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Kieran Bingham , Laurent Pinchart , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 144/191] media: vsp1: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:49:59 +0100 Message-Id: <20201027134916.630340579@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit 98fae901c8883640202802174a4bd70a1b9118bd ] pm_runtime_get_sync() increments the runtime PM usage counter even when it 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/vsp1/vsp1_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index eed9516e25e1d..5836fb298de27 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -549,7 +549,12 @@ int vsp1_device_get(struct vsp1_device *vsp1) int ret; ret = pm_runtime_get_sync(vsp1->dev); - return ret < 0 ? ret : 0; + if (ret < 0) { + pm_runtime_put_noidle(vsp1->dev); + return ret; + } + + return 0; } /* @@ -829,12 +834,12 @@ static int vsp1_probe(struct platform_device *pdev) /* Configure device parameters based on the version register. */ pm_runtime_enable(&pdev->dev); - ret = pm_runtime_get_sync(&pdev->dev); + ret = vsp1_device_get(vsp1); if (ret < 0) goto done; vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); - pm_runtime_put_sync(&pdev->dev); + vsp1_device_put(vsp1); for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == -- 2.25.1