From patchwork Tue Apr 27 10:25:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428656 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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 AC854C43470 for ; Tue, 27 Apr 2021 10:27:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77A11613B0 for ; Tue, 27 Apr 2021 10:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbhD0K2E (ORCPT ); Tue, 27 Apr 2021 06:28:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:48138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235435AbhD0K2C (ORCPT ); Tue, 27 Apr 2021 06:28:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 04262613C7; Tue, 27 Apr 2021 10:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=/e5UeIJiSAmhayjaD9UYfjSrnpizVQ2PnDpNxKl2/+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkykQfPooUdW8MA0VwbO7dz14rqXn1dm5gOHEOLQDuawdcXjO5xbUgaP+Y8iOQLhV psz+0pguVumRSPLnBiZ67uXgvvVt310sGRRbHlWP+ctgzGkgDrQk1v1zwO6Q56cRGD eeRpgu6PJFTQSZsKbxzxDREwWzL4XF2fSXMzRTKr8qd5AftNMhHOVneQh2L6aag6jH cAckoUc83ZHnFUG61QCWJR788Urg6EEMDkc1AEARvq97cF1v2AL+zraQvR8juS9yH/ ukQIin8P3zAnAsRFJnGfJ9fbLIqfBmdvZFbTGsoRfQde7qGv/mayieWt99cRuaCY+L etRezsYsMlM+A== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvu-000nzG-Ro; Tue, 27 Apr 2021 12:27:10 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Hans Verkuil , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 01/79] media: venus: fix PM runtime logic at venus_sys_error_handler() Date: Tue, 27 Apr 2021 12:25:51 +0200 Message-Id: <6d463d21f0dd55c3d84db0458c7a5c4e0d7c5bc1.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The venus_sys_error_handler() assumes that pm_runtime was able to resume, as it does things like: while (pm_runtime_active(core->dev_dec) || pm_runtime_active(core->dev_enc)) msleep(10); Well, if, for whatever reason, this won't happen, the routine won't do what's expected. So, check for the returned error condition, warning if it returns an error. Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 54bac7ec14c5..c80c27c87ccc 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -84,7 +84,11 @@ static void venus_sys_error_handler(struct work_struct *work) container_of(work, struct venus_core, work.work); int ret = 0; - pm_runtime_get_sync(core->dev); + ret = pm_runtime_get_sync(core->dev); + if (WARN_ON(ret < 0)) { + pm_runtime_put_noidle(core->dev); + return; + } hfi_core_deinit(core, true); @@ -106,9 +110,13 @@ static void venus_sys_error_handler(struct work_struct *work) hfi_reinit(core); - pm_runtime_get_sync(core->dev); + ret = pm_runtime_get_sync(core->dev); + if (WARN_ON(ret < 0)) { + pm_runtime_put_noidle(core->dev); + return; + } - ret |= venus_boot(core); + ret = venus_boot(core); ret |= hfi_core_resume(core, true); enable_irq(core->irq);