Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp250231pxx; Wed, 28 Oct 2020 04:06:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylFmPEGoVddcydFjt+EC26peCZsTesGQzP0zQ1oOV34ur1MI6LaDobk4t2cTaivK8kcE2u X-Received: by 2002:aa7:d892:: with SMTP id u18mr7267657edq.305.1603883174570; Wed, 28 Oct 2020 04:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603883174; cv=none; d=google.com; s=arc-20160816; b=b8NPVuRwMhlab7HH92G+jNutLtsQNv43QRzYTppB2OEAMWSRbl4twFx5qAk7zunKHw 0RqOkVE/zYnVTWH8D9NLUzwYf+9NQA9ORohTAOVRS92/kkzCNB55tL/JWivuVt3+2kg9 zQAufFUkiLB8bpktc/lfwOsQdXUJO86R1oDR8jaFEuFa2qOYf1OCjuvh8EvLa5+1GtxH no0ZJJ6bQskiEbjejKS/oHz5+CzmRIKoy4vuNH3TzOtvAY6Gm9tx/oMYk0myMCp08OUu pYVk/pEPYMfULA+M1cxCN0DYsCj1sw+5GKipgZ4zCY3US/HNp4PL1hKkGBGno/mPBOwP /S+A== 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=nGeH6xIxEjOmij4DBvp2D6IauR/Nrhp7Xq2ZJWIGzR0=; b=pixi7amHiB4OWG3897Pe1iGfvYJ2XpW+zf8PnsnK4mjx5vCOcWdIDPjOsopmAonFNt 6oM3Z11ayAug3/os7lNP+SkIMx2wUoo9gOpkXboYml1BV8LYDwJysCwLl37zVLUMiXBD CtjyBUGRsHn1dz0UluD6KOBlz3BGHN9Sqeg8jFsn3lXno8kl183ByKP+kxTHYNfJVVhJ b+j4mMcDgftzZI6foy11jydxor3ruz6E39K/GL0meBglfDRi46ev18l851PwUrym7MKk BF2ACGDTdBb+sx6NtSFkwiAoIOu55LjyFSY+Zmu+G4T2OYRU4Ts5yPAE8dhZzo3TOrU5 SOhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tEmfJqz0; 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 p19si2741759edu.169.2020.10.28.04.05.52; Wed, 28 Oct 2020 04:06:14 -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=tEmfJqz0; 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 S1785758AbgJ0O7p (ORCPT + 99 others); Tue, 27 Oct 2020 10:59:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:43782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762660AbgJ0On5 (ORCPT ); Tue, 27 Oct 2020 10:43:57 -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 93C77206B2; Tue, 27 Oct 2020 14:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809836; bh=oDOnjFHkVgiIoA7tw0e2d0rfAy5TH6MzhU8d0U9ZVbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tEmfJqz0YQzDwW/yoyV37jiazCNzlyaCiPjv5HbPSTf2egBEZTIbVXrLjTqs2D6hB tnHtHQUScl62OKXZv2YwddTZEC4CMEqg7YRLQOUcRXsNaKodaIlPYl6cUnlU8vrKfP vbpoNoqhSOcNt8Z2UHYua5k6dbOLa7aHjCi3u6TU= 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 5.4 336/408] media: vsp1: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:54:34 +0100 Message-Id: <20201027135510.621146646@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 c650e45bb0ad1..dc62533cf32ce 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -562,7 +562,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; } /* @@ -845,12 +850,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