From patchwork Sat May 23 10:03:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinghao Liu X-Patchwork-Id: 209731 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 191B0C433E0 for ; Sat, 23 May 2020 10:03:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF81420735 for ; Sat, 23 May 2020 10:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387695AbgEWKDt (ORCPT ); Sat, 23 May 2020 06:03:49 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:16114 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725270AbgEWKDt (ORCPT ); Sat, 23 May 2020 06:03:49 -0400 Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app2 (Coremail) with SMTP id by_KCgCnHr709Mhe2tm5AQ--.78S4; Sat, 23 May 2020 18:03:36 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Philipp Zabel , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: coda: Fix runtime PM imbalance in coda_probe Date: Sat, 23 May 2020 18:03:32 +0800 Message-Id: <20200523100332.32626-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRAN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VFxhVjvjDU0xZFpf 9x0JUd-B_UUUUU= X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgQJBlZdtORGcwAFsi Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org When coda_firmware_request() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. Also, the caller expects coda_probe() to increase PM usage counter, there should be a refcount decrement in coda_remove() to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/media/platform/coda/coda-common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index d0d093dd8f7c..550e9a1266da 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -3119,6 +3119,8 @@ static int coda_probe(struct platform_device *pdev) return 0; err_alloc_workqueue: + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); destroy_workqueue(dev->workqueue); err_v4l2_register: v4l2_device_unregister(&dev->v4l2_dev); @@ -3136,6 +3138,7 @@ static int coda_remove(struct platform_device *pdev) } if (dev->m2m_dev) v4l2_m2m_release(dev->m2m_dev); + pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); v4l2_device_unregister(&dev->v4l2_dev); destroy_workqueue(dev->workqueue);