Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp175992pxx; Wed, 28 Oct 2020 01:40:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz/bufyg4amjmI/xs0Y8RL6rYt6tD/MS219F6tThZTvCWgmnxDDQ6QlhvBa9WswGHiBtKO X-Received: by 2002:a17:906:b1c9:: with SMTP id bv9mr6588289ejb.495.1603874427096; Wed, 28 Oct 2020 01:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874427; cv=none; d=google.com; s=arc-20160816; b=mqBOgDw28FVFkSpKX3T/UvY8qf+mIH6HCzXJV6HFajtRabAtl2ptTg4S9DUVneluFv UF3N2oAV1s6ahHrSQN/yzhX5Pt/tM6om8j5Bn2h65ij+SOyVdu8/rSVcf4owu59MfMBq CQqtzEymoLHu6DgppqY1WFtzCua/00/kmw2DUlRxyCpLUZYoX6eLAIL1lV55BOuqzJuN 7V20By4uqaF7q31aiaSWpNaiTIiCRzt2CuevmhrixltMbgVGutPrB26HJNmCAZHj0VA0 60pflhNXEutBPuu/wWcJbjcjNHBNXp05onZfD4/lqRcI9eu8vUmGlj2wJfRcm745HdmB beDA== 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=T1VVLoah10AIkfcNBxGXlcBJqfxsJfdOukqIOHVwaK4=; b=qxi4uafhT7x9mUIpZNi2xMDdo4K+jtsRdXx1q7HTQtgus2hrQKWvCew+LTZYi+jh6P +G1R2na8b+d5Lp38peHevgCXd0W3MykOPoj3tHXwp974hu3C4fp/IkInAkMBbh6/K5o/ g2ZxtYBC610Z/rCfM1S0ukV/ARLUC4oE9u3GjE1eznOwH6U5AFvQPym8fgtYE7kiijf/ gxBr+u4dV9aXYwFRbNY5oTF+tuKv2vE/YAjg0e52zA1vbMlUPhXuPGOHSCAOcbhTjlBZ lOsXmSNSRwHd/hTTTo3E5BhQJQzEuodiVQoqc6m60ZqG9HtMcJZCS+GGSlVAzsa5apXc CJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bWi+o2wP; 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 w11si2719069ejq.533.2020.10.28.01.40.05; Wed, 28 Oct 2020 01:40:27 -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=bWi+o2wP; 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 S1754944AbgJ0OHq (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:56128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754850AbgJ0OHX (ORCPT ); Tue, 27 Oct 2020 10:07:23 -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 D149322283; Tue, 27 Oct 2020 14:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807642; bh=lvpSOiowpkc4Fz/zItNb7eMapzCbdBEdXFPaVboawhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWi+o2wPzD1oroJw5/HpGY7noxnVTeMN1ZJVbkhnqix5ZVT/C7KNw1NF+diE7jBaN Vz84KBKpGF/ONxnJuqXHv4lr/DhwTMzYMvBN46E9BaoiV2eh/qjgTSd2cuZL0+hGvL a/2D/eqTACZNVCCxXg54MD0P/TJx7uCGZv2kzSwU= 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.9 100/139] media: vsp1: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:49:54 +0100 Message-Id: <20201027134906.887895556@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 4ac1ff482a0b3..fcb1838d670d4 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -487,7 +487,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; } /* @@ -727,12 +732,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