Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp181681pxx; Wed, 28 Oct 2020 01:54:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN1iVhGJBh16u+Ft6lYTdPgtNFN85jdwAvzrmzj/y4ADgtgbenENohjW9P8M94PLvvIs9K X-Received: by 2002:a05:6402:1c1b:: with SMTP id ck27mr6734317edb.218.1603875296522; Wed, 28 Oct 2020 01:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875296; cv=none; d=google.com; s=arc-20160816; b=cef4U//8gLoz++9jIDQvzdiHaTS9H966HtmV/CtPVrFFVEMEv/hfLMzHoICiJJnYhG ueApDqLN7grgGzvaXFeQWZkFN1zj2WecYjXdyUO2P+d58eClPvqd/BNc2m+whou/gf+V XNPdztO7HkAZKxPIOU2ooFWfgIMKtsxh5zduni5fGwbl/Jdq4jBejHUsCEjDGvA9eDQB WDj65+n1mYkUKh+2X7wnd1U6KKCGvj+9yqUjXKyPz7g6H39n30fE5hEUxZql8jwP/Zjt 6egJOGC7XQEF2yn7Mt2s1c0RE+cflua98cTCLBE0tpYkPFFhf2jx0jQiYLTM9pnOPzvD oL5w== 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=fQkqHAKS2wbNXZkp5xcIS5JzbesiFYIa9dBwHf3P6hA=; b=M5I3N7Q6CeueA44P474v40B9NjGux9kMcIwX0KZtPOFVBwLq7tslr/qFcI7t7mHYcZ X0pW7IRcvVEEYIe58Y0mdNI3LoQdfH5FCx0Zue4V8+JISaE1nDqeZO5gJpzoxJf/pSya V7JpBlzlFzPKRqyPAIyCLoEoUC0fw3C25H/gakRfqbIUFks27HWDM8Hk2eaal38gnGt5 e634uIt+zowN2Isl4oyMZyyMRTUf/Ilgey0FD1FpLHRx7y+LPA8yDTQA8SChwMT+9c9G x0HiHtuO5gUVak+Frt2qRcrjIxJ6QXcisNi/0JWPymPdsOTX4dvLlBDPVtLivdhTECvM nvhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aS+yx0ub; 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 l12si2820211edk.163.2020.10.28.01.54.34; Wed, 28 Oct 2020 01:54:56 -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=aS+yx0ub; 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 S2507345AbgJ0ONm (ORCPT + 99 others); Tue, 27 Oct 2020 10:13:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:56392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754887AbgJ0OHd (ORCPT ); Tue, 27 Oct 2020 10:07:33 -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 B299F218AC; Tue, 27 Oct 2020 14:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807653; bh=xV8v4HsfW/T/pSVmTp0YC8+BuJdwI81D8/nK9ImUFdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aS+yx0ub55B/W+P5IeIbfOT5iI1A0Hn4cVEQq6BZcq4it7H3SVrXQKhBvupfAKGLL Ny+74Ae2S/Xy4QRLHADDI2NDTbOG9a5YRIO12mn917OGem1bYbkdoFGbqdIFlagQmi ZJRLS/Ss5qtkIS0T5zUOcGJpIInofIUHhjyFOK1M= 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 4.9 101/139] media: platform: s3c-camif: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:49:55 +0100 Message-Id: <20201027134906.929869714@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 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 ec40019703132..560e1ff236508 100644 --- a/drivers/media/platform/s3c-camif/camif-core.c +++ b/drivers/media/platform/s3c-camif/camif-core.c @@ -476,7 +476,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) @@ -510,10 +510,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