Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9024386rwl; Tue, 10 Jan 2023 23:57:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsgQcn5HvM88cWLYjWo6dAKyOIWePoXFAPFgyOuwzDDXZ8waQCnqhmwHtqvQyh2Ti7rak0Q X-Received: by 2002:a50:ec85:0:b0:492:8c77:7da9 with SMTP id e5-20020a50ec85000000b004928c777da9mr19494990edr.9.1673423860766; Tue, 10 Jan 2023 23:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673423860; cv=none; d=google.com; s=arc-20160816; b=RUuuaIuggW31t5ggXVC0Ga3+F7eAmRGklcCUYSsg7DAJPNExT3B3KuNNcCicoqEbSn dqrUJri7bkoHAmDcCshQAO4GcBiEWBjMp3QUfm5z8VlEPx/0aStCP1yxGl5ud8pVEk3i 8JPTvF6v75wfFI3DnogkRGrMtJpPgcERRGnCZ/mTTAfB8vILEq7svECXH2l9QBSK6iHv SPVco2Fxa0awzeBEitdFgBaiKBjJUekNT1VFWndxo9IAtYA5xZmgkCi28IUjjn/ItuSx kHsm4UM/f2Yv1TS/kwj4ga3m0SuvzcaNkG14BJqypncD6YrMS/ouWGBd63d90aUdlzdn 5rGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3Hk6/LOaCSVWYRTs09f5CDgwCj2clql0+dtr3RCnhuo=; b=JjvKtlbWvLbl47fYRJAtabxFOxS0rA624AcIvKfPRDdrovhB+6lP7/uCbud4U8gljy ZDqJnqgsBFdT5ntSPbZtbMPjArnIObKH+n5RKnMucLCnellmY9lC+2SVcdv12/6aBMbs SjnaRtpg+lpkYhYaQK3nQjVLoP45nK7AEptLyYSRtGLcl/0nfnfp9zCuyQA0m59Tujg9 k5Ei51b2lUWBY0Daz4qF9fFqEJr3ISG6dHCk4axdsyBkOi7YkObmYvN6hpHkjqYQAprZ g2nMSfags/+fye/gOyTrhaww+pQumRBUGCeYfmy6TFlbw53jbwDjXxU+AslrzgHbxcfd Dfjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DrJBxKk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a0564020f0200b00499bebe0ff8si5747211eda.622.2023.01.10.23.57.27; Tue, 10 Jan 2023 23:57:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DrJBxKk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235989AbjAKHpz (ORCPT + 55 others); Wed, 11 Jan 2023 02:45:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjAKHpp (ORCPT ); Wed, 11 Jan 2023 02:45:45 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1150611453; Tue, 10 Jan 2023 23:45:39 -0800 (PST) X-UUID: eca6752a918311eda06fc9ecc4dadd91-20230111 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=3Hk6/LOaCSVWYRTs09f5CDgwCj2clql0+dtr3RCnhuo=; b=DrJBxKk2yrQ15UTJZAyWdHYXD/HYJDpTATD8vKlytkRX7YcoyaXzEqAFvf5xi5KTwGJcDhrEXxo+Ui5eBxB5vKfDJgOtY/Vw+CLkh+6mpNvLuF0MOMkFULFUKIBIDyw8NCqeAQtMYiwTb+/pIayvjC2M1kduYO7XHGhcFeEZkOs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:5305f8b5-2c8a-46b7-91d0-e5ec9bbd6432,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.17,REQID:5305f8b5-2c8a-46b7-91d0-e5ec9bbd6432,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:543e81c,CLOUDID:e1747df5-ff42-4fb0-b929-626456a83c14,B ulkID:230111154534QHX5H8P7,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0 X-CID-APTURL: Status:success,Category:nil,Trust:0,Unknown:0,Malicious:0 X-CID-BVR: 0,NGT X-UUID: eca6752a918311eda06fc9ecc4dadd91-20230111 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 661439306; Wed, 11 Jan 2023 15:45:31 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 11 Jan 2023 15:45:30 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 11 Jan 2023 15:45:30 +0800 From: Roger Lu To: Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Nicolas Boichat CC: Fan Chen , Roger Lu , Jia-wei Chang , , , , , , , Ricardo Ribalda Subject: [PATCH v4 03/14] soc: mediatek: mtk-svs: enable the IRQ later Date: Wed, 11 Jan 2023 15:45:17 +0800 Message-ID: <20230111074528.29354-4-roger.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230111074528.29354-1-roger.lu@mediatek.com> References: <20230111074528.29354-1-roger.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ricardo Ribalda If the system does not come from reset (like when is booted via kexec(), the peripheral might trigger an IRQ before the data structures are initialized. Fixes: [ 0.227710] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000f08 [ 0.227913] Call trace: [ 0.227918] svs_isr+0x8c/0x538 Fixes: 681a02e95000 ("soc: mediatek: SVS: introduce MTK SVS engine") Signed-off-by: Ricardo Ribalda Signed-off-by: Roger Lu --- drivers/soc/mediatek/mtk-svs.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index a803b92afc3d..64d4d03ab71c 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -2403,20 +2403,6 @@ static int svs_probe(struct platform_device *pdev) goto svs_probe_free_resource; } - svsp_irq = platform_get_irq(pdev, 0); - if (svsp_irq < 0) { - ret = svsp_irq; - goto svs_probe_free_resource; - } - - ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr, - IRQF_ONESHOT, svsp->name, svsp); - if (ret) { - dev_err(svsp->dev, "register irq(%d) failed: %d\n", - svsp_irq, ret); - goto svs_probe_free_resource; - } - svsp->main_clk = devm_clk_get(svsp->dev, "main"); if (IS_ERR(svsp->main_clk)) { dev_err(svsp->dev, "failed to get clock: %ld\n", @@ -2438,6 +2424,20 @@ static int svs_probe(struct platform_device *pdev) goto svs_probe_clk_disable; } + svsp_irq = platform_get_irq(pdev, 0); + if (svsp_irq < 0) { + ret = svsp_irq; + goto svs_probe_iounmap; + } + + ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr, + IRQF_ONESHOT, svsp->name, svsp); + if (ret) { + dev_err(svsp->dev, "register irq(%d) failed: %d\n", + svsp_irq, ret); + goto svs_probe_iounmap; + } + ret = svs_start(svsp); if (ret) { dev_err(svsp->dev, "svs start fail: %d\n", ret); -- 2.18.0