From patchwork Fri Jan 14 11:02:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 532461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6409C4332F for ; Fri, 14 Jan 2022 11:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240637AbiANLCl (ORCPT ); Fri, 14 Jan 2022 06:02:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239554AbiANLCj (ORCPT ); Fri, 14 Jan 2022 06:02:39 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8851FC06173E for ; Fri, 14 Jan 2022 03:02:39 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id c71so33601652edf.6 for ; Fri, 14 Jan 2022 03:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CwOPSI/x6WISy5xaU7A1XOITYlC8CEEnNs70uyu/4VI=; b=lzuTvcA0vLRGjWdJGefFU3SwExD2klLSvu84jf3QsHuqXy9tD1ct/VclxTjuFu0Vqp 04J8cJTwUhAJYvDCH1P8mkJY7LrOrcJXGhgvySbnXRdEqpchFD+ve1CK2fK1rIyP9hyT yNjM0WAzvOd0fwmRJblY/9YXgp4hC73JNa8T3NqoPz8CnEmiaIrFWbmylyjxRuk0ewmj +r5CeWStEeOFu7NFJin8ndTKQcsTOvmus8PgdjoK3EiiU7f/xffuub3FMctskUT5eDCo 13II64iddxTPwVeldzmLnBZkObxhlGIlVgDoXjtTxg9yt74K5b2vqZ54nFEnZ9LbklTv QE6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CwOPSI/x6WISy5xaU7A1XOITYlC8CEEnNs70uyu/4VI=; b=IiaGXquce32tDIvWflNxrUlbm3v7MLoWNAsnSTBpb/mOcGWaYXCS224EpGz4557Dys UcbyVARMYNj7Y84dHVy9W0BvkZ0eMcIbRCfG0azW0R0nqg5G5YElgEe8WZuHqyM/cgim kxYmDb9CZZgugAj/R456i2Njush3bveD3ZQ6XJZGsNkCfGtZu8mupPon6qxazb1vu6ia Vuz4KnbB9XyOHWVRK5Ygyx/vNX1hX7jx8gx3W6yJpkAgV3apM9l0XfEgUa5Uhwk5Lx0k NlP4i+xnbpOOh8y5WDuCFzWFLKkWOQGx2QWfk91GrUHpDXPKBVeMB7/oOBv6Nwa7rlR0 2CMQ== X-Gm-Message-State: AOAM532K67jVxTwYKHSlqJ5Wk/SvgYy5VBlCBcPivDGnQuTX3H712dF1 QaZCCKe8owr4+fR789Zf0t1AwVgVsS9dYSi/ X-Google-Smtp-Source: ABdhPJx1j9WH9qLXW9VT1IwVpHidffKuqTuHnKtBK0Kpxdic00MomCcR6Dm0CVCrpI9PmLCbklcOFw== X-Received: by 2002:a05:6402:11c9:: with SMTP id j9mr8406792edw.411.1642158157759; Fri, 14 Jan 2022 03:02:37 -0800 (PST) Received: from localhost.localdomain ([2a02:a210:20c5:8c80:7d0a:cd68:c339:f426]) by smtp.gmail.com with ESMTPSA id 21sm1725718ejz.24.2022.01.14.03.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 03:02:36 -0800 (PST) From: Luca Weiss To: linux-arm-msm@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Luca Weiss , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] media: venus: hfi: Add error message for timeout error Date: Fri, 14 Jan 2022 12:02:25 +0100 Message-Id: <20220114110226.130380-1-luca.weiss@fairphone.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This error can appear with wrong configuration and is difficult to find as it just returns -ETIMEDOUT with no further message. Signed-off-by: Luca Weiss --- drivers/media/platform/qcom/venus/hfi_venus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 3a75a27632fb..9a34662fea38 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1583,8 +1583,10 @@ static int venus_suspend_3xx(struct venus_core *core) */ ret = readx_poll_timeout(venus_cpu_and_video_core_idle, hdev, val, val, 1500, 100 * 1500); - if (ret) + if (ret) { + dev_err(dev, "wait for cpu and video core idle fail (%d)\n", ret); return ret; + } ret = venus_prepare_power_collapse(hdev, false); if (ret) { From patchwork Fri Jan 14 11:02:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 532040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E35C433FE for ; Fri, 14 Jan 2022 11:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240647AbiANLCq (ORCPT ); Fri, 14 Jan 2022 06:02:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240646AbiANLCo (ORCPT ); Fri, 14 Jan 2022 06:02:44 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3707DC06173F for ; Fri, 14 Jan 2022 03:02:44 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id z22so33570278edd.12 for ; Fri, 14 Jan 2022 03:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fairphone.com; s=fair; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nfTpTGejjbs1/IGPoPayvAsK5HXiDgr01tfB1Ox12/o=; b=F4kAU5sR4g6LVo0JnWblWrXfyVfC4H454DjEzaz7/ozw0szvs3R1q3Y91nZ1hCi9dh zx/WWapKaJ3nGVMZzcVilNc5dPgRr4A8TEK3h9GBFI/m4/LWda1yVgFQg7CmHg8E6XAC FdZbhGUyGHbK/UYiDHMZ/o5JHdXDmY1m4WI61dRVsRNfwGyHFDwvsHRuNb4qRiLop0mh Y90+yFSHNiyAMKqkCxHKrojCHqVEaCTPG03p5PTnnfVG8w2z8fuh5h9dq3sEjyppfa4o 9YkZ+snIayxn0AD5clE9HBui221LF9ToMbKcnX0tyMaLkLQ9ht5hph4jwJrQ2dg1NrCJ Zx1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nfTpTGejjbs1/IGPoPayvAsK5HXiDgr01tfB1Ox12/o=; b=ml8ShksaF/1YFtElHzc2eOMeF7fYdG5bkefp7D4OblKSW8BnccM+bGpByvI7jDNWlm 56UKqee8aMkbMLAiHpwPT5omo48cfsswq96Z00Y37Dq4Juw5nJC9IOZwxEsBMuFupM/A 3keJtjzOXmrQNSzJvBHL9KWPDaIa9DWthqL/c2+2A4mcmjjag6J2HRtQPVgMXH5jfOFC F8SmmqVVgojPDEww8SXIO6iwfoIMrJlDu3WDk76gIrMOltASMVpSoIaMssAVS6JqLh7C 18dwtYuyYOnnFWf3gyT1bO2rJW2BaGO4Jj0l/Vpe/5UtkdcV0ay80n5n4KuskyG9sLxa xp+w== X-Gm-Message-State: AOAM532FGfFxC1bclqenHhAZX+JAJnRbTLBDsDWu7vlRf5JWtRl9Q4+X HU7bmDktzYb+U0ux/e+9bu6ewyZDDzLA5YyO X-Google-Smtp-Source: ABdhPJxrqLroV1LJ+YyoXVnpa0G8hJgPhVutmPuZ1ZhswksM4KJynfcwHTX4uevBrPH9BDYmLyIFdg== X-Received: by 2002:a17:906:9b8e:: with SMTP id dd14mr6629836ejc.307.1642158162583; Fri, 14 Jan 2022 03:02:42 -0800 (PST) Received: from localhost.localdomain ([2a02:a210:20c5:8c80:7d0a:cd68:c339:f426]) by smtp.gmail.com with ESMTPSA id 21sm1725718ejz.24.2022.01.14.03.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 03:02:41 -0800 (PST) From: Luca Weiss To: linux-arm-msm@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Luca Weiss , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] media: venus: hfi: avoid null dereference in deinit Date: Fri, 14 Jan 2022 12:02:26 +0100 Message-Id: <20220114110226.130380-2-luca.weiss@fairphone.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114110226.130380-1-luca.weiss@fairphone.com> References: <20220114110226.130380-1-luca.weiss@fairphone.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If venus_probe fails at pm_runtime_put_sync the error handling first calls hfi_destroy and afterwards hfi_core_deinit. As hfi_destroy sets core->ops to NULL, hfi_core_deinit cannot call the core_deinit function anymore. Avoid this null pointer derefence by skipping the call when necessary. Signed-off-by: Luca Weiss --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 4e2151fb47f0..1968f09ad177 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -104,6 +104,9 @@ int hfi_core_deinit(struct venus_core *core, bool blocking) mutex_lock(&core->lock); } + if (!core->ops) + goto unlock; + ret = core->ops->core_deinit(core); if (!ret)