From patchwork Tue Oct 27 13:55:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 307350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E89A0C5517A for ; Tue, 27 Oct 2020 16:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A6FB218AC for ; Tue, 27 Oct 2020 16:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816440; bh=om6wxlB1/VxnZ4ZVJ9hqX/LgMe+u5XTM+cmXj2zooII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hXLYZeZeserUdNzPE8ukn9pwWNAnY9bS+0EouExbQ578FufraIwue7hy8LeJCUGXm aqMJcOmFud48N+25r08GJS/Y2aD93ACjw+082yfV3cTs+Pbw1swlNCbqMsUNiJa/dJ lxn0fI4vrdsiHT3SvZ3HU0Q8D5NQWin4MnRQQY28= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1802476AbgJ0Qd7 (ORCPT ); Tue, 27 Oct 2020 12:33:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:49860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1802468AbgJ0PtB (ORCPT ); Tue, 27 Oct 2020 11:49:01 -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 412FA22281; Tue, 27 Oct 2020 15:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813740; bh=om6wxlB1/VxnZ4ZVJ9hqX/LgMe+u5XTM+cmXj2zooII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gLX/8qj2xm+qbRq85aGzjlv7kFEhWJeiHLTHuab88rt2vsczES8xljspCK4BctMhN XgnpPJeUGBT6rdyT68BS1+g54MVJ/7H54YGf2Bgyy8LGchHBKeoYZNl1E0eBCph486 vCqvFQpYOrBBo2iAPlj6tAxNuV5acSytT/+4o4Hg= 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.9 655/757] media: platform: s3c-camif: Fix runtime PM imbalance on error Date: Tue, 27 Oct 2020 14:55:05 +0100 Message-Id: <20201027135521.246781196@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 92f43c0cbc0c0..422fd549e9c87 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);