Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp235269pxx; Wed, 28 Oct 2020 03:40:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX6TxF46fscTbkHCHBg4JvjMg7v/aPLhysYC7xOUKLJr9vy3snPpqKJ/bvf0FeFENoEuv6 X-Received: by 2002:a17:906:48b:: with SMTP id f11mr7033452eja.293.1603881613703; Wed, 28 Oct 2020 03:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881613; cv=none; d=google.com; s=arc-20160816; b=kC+YR8dWRnz+QI/PjiofGwLpbSF2PZzIIfez87ZceCDu6dBw4h2Ab3OG3nvp+vrRtD De+apBYeTWXtZwEgHxEp7m9p9EITnuCbqrZDLMTldtU+LGu91NYnxdz8Gg2HINFabJ3M zmuPTaC/nj9pVHwFzntBLSDwetVgg890syk1srg6UUSnXqPdDahbUeiK5+BviD6wt4YS M/w7mOV5IXrEQimI90mSEpBqAc29Rw7ym69dTp0TvDU/ctj700dc4QBbVwsFF784USzD CXMYRF/9ec6xmETLwJi+k+pYya5bNZ0kDZ085TaKKBsKRlbveu6ts17y0KMmB+uUadTp 2OZA== 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=CVA38Ou0meO9Vp2Ep19riKw13AdL177VFgA3OpiNTic=; b=PwNcAu2UO0DM5Ql8jpwqbrV0xc56DN/sPutB4BePtcSspclq3Akmlrcr16y58nJRV3 fZEF+vxiU55n7xh3wzo0HrdVe5Qe+nLJ4MYOZ7/pdDsw08SKexVuk2RpJHswt0jxrF1N Iisl16WgtWkmoUkOp5RdtpNCOmL3Lk17fOiZFEvsVbB1OHv5FiT8YMFi6M5G4CGqIfcw nuaaSjSfrsD5UNAk3PZEtEq4Oe6P7REnR6QTFuywbXY8Sl96kOgzdnnbyl/3KsIX69nA P1V9jWHl8ofvmfViaZ7KQKwtG1yrt3zzYR7VkqntKmAJBl5k+nE2tdt5Qu41ra9opsb+ CzQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Imv3Cr+l; 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 d4si2698178edr.173.2020.10.28.03.39.51; Wed, 28 Oct 2020 03:40:13 -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=Imv3Cr+l; 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 S1763675AbgJ0Oos (ORCPT + 99 others); Tue, 27 Oct 2020 10:44:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438679AbgJ0On7 (ORCPT ); Tue, 27 Oct 2020 10:43:59 -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 9514420773; Tue, 27 Oct 2020 14:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809839; bh=XiJLm7dJT4iYtMQfAyf59AS4prF8Kb681A/GW+JkWyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Imv3Cr+lezRHDZdWncIf1u50P00ImxdsdgT2l2rj95uimM14ZIIUOdgu/USPA24Uj d/9JWXeN29O3tBS7yNBGKVq1F9lZpPvY9uRU+yVYGKduhuomES1lsLEanPOXtwcErg m3WpDro/110fH7YxURH+VjoW6Yaq7GUkmtGlbtdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Sylwester Nawrocki , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 337/408] media: platform: s3c-camif: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:54:35 +0100 Message-Id: <20201027135510.670079306@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 dafa3605fe60d5a61239d670919b2a36e712481e ] 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. Also, call pm_runtime_disable() when pm_runtime_get_sync() returns an error code. Signed-off-by: Dinghao Liu Reviewed-by: Sylwester Nawrocki Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s3c-camif/camif-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c index c6fbcd7036d6d..ee624804862e2 100644 --- a/drivers/media/platform/s3c-camif/camif-core.c +++ b/drivers/media/platform/s3c-camif/camif-core.c @@ -464,7 +464,7 @@ static int s3c_camif_probe(struct platform_device *pdev) ret = camif_media_dev_init(camif); if (ret < 0) - goto err_alloc; + goto err_pm; ret = camif_register_sensor(camif); if (ret < 0) @@ -498,10 +498,9 @@ static int s3c_camif_probe(struct platform_device *pdev) media_device_unregister(&camif->media_dev); media_device_cleanup(&camif->media_dev); camif_unregister_media_entities(camif); -err_alloc: +err_pm: pm_runtime_put(dev); pm_runtime_disable(dev); -err_pm: camif_clk_put(camif); err_clk: s3c_camif_unregister_subdev(camif); -- 2.25.1