Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1420335ybk; Thu, 21 May 2020 06:32:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWYFwX0UzazLEhlCFfxc8sAK6pt8/aowcrnXSCNpOUs8Q/vsagSFxd5doMb4nPNPRewb+4 X-Received: by 2002:a05:6402:2213:: with SMTP id cq19mr7782820edb.337.1590067969812; Thu, 21 May 2020 06:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590067969; cv=none; d=google.com; s=arc-20160816; b=qe4yuc7m7zavAto/92b57juVSeutfoHmWdMD6EHCTGOOIpqMvqh/HWmfNVXv16JLsE tEcPtH1xsagjmfadhI9g1Hcbnsx9zywtqgEPI8WmwUs6fLOJwzUUblyeVmoMlZPtswDW IzWAoDvT9KfgoLqq06nK61kfTRbZJCT+jgfySFL8Tdliql06zyh2unoh8WvZsxd6mHdh iJOAz9jA9C/wQNGOcORASUhP+dBRgiqVw3rK620I/jAqnpR8q2NnvmmWXJC5UmKOFrdd ZgH9RoTfnnHMd+NM+LieZ6hBiwxBdvjCjlXVcknfItcz3U8beDjl7pvwa4uGJ+kAUwip WvKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=pVNE5mAwhqr6KQ1+3niSC7YSnn1Zv9kcLap9PZvhQGM=; b=nMmBiSks92EOEsRZSRMzi2P1GAkOd42MTARspVur5ruKU/8ufOT/KNltkfL9JYxl5B zDy91oqKxlSp0mkqy5nISB9j3SV55S6GagmthXBZJ+RJRVpzaT2QZl7Ko4MhD12lHmtB bQ5TziFhfq6ImOqe3ov5qgxX9fUGCsFuxBC1I2IiQEakQOXoqxZ7djHyjMPcTYBNhi5Y CGt55NS7VKxfru1BUdfoBny04kE9pg8d6zrPwhQcG1C/4bthxbscv+2HNBLorsf2S0th AKNf3YXbUgycIh4jRURncugQCvn4i1gSSaLtJ8pNBYwExNK/7Bo9rFBW9nPkMU4dTsd/ hV5g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i20si3349100ejh.129.2020.05.21.06.32.17; Thu, 21 May 2020 06:32:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729495AbgEUN3z (ORCPT + 99 others); Thu, 21 May 2020 09:29:55 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:18992 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728208AbgEUN3z (ORCPT ); Thu, 21 May 2020 09:29:55 -0400 Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app3 (Coremail) with SMTP id cC_KCgBnb4s+gsZeAGHpAA--.12833S4; Thu, 21 May 2020 21:29:38 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Sylwester Nawrocki , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance on error Date: Thu, 21 May 2020 21:29:33 +0800 Message-Id: <20200521132933.16450-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgBnb4s+gsZeAGHpAA--.12833S4 X-Coremail-Antispam: 1UD129KBjvJXoW7ZrWkur1furWrGw17XFyrZwb_yoW8GrykpF 4UGFyI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@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 c6fbcd7036d6..ee624804862e 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.17.1