Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3087216rwl; Tue, 27 Dec 2022 04:16:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsd2FdrU9H9+IaeCJ3qcoPHp6jb0XYvNDj8gmaakIYqxLxwycaUexq5aXY0dudTx8tklqPP X-Received: by 2002:a05:6a21:394b:b0:9d:efbf:48e3 with SMTP id ac11-20020a056a21394b00b0009defbf48e3mr26959390pzc.39.1672143370843; Tue, 27 Dec 2022 04:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672143370; cv=none; d=google.com; s=arc-20160816; b=ZfSmj5I0baQBbCmoFPLlpWNUDXm6DRpOyEFgXR758FW+JzGeN1mA2Q+cWcosqsHuv5 4Wb5YSr0IPX0Z2BbC43N4fog9HpS2P+X2+EGE03YYNhi2EPol50b+Rn+++J6oKy/uSqy YEXKktOOndYWnih/Ytr9vxFI/5UW0IWPipaJn2z7fox8lk4frCNfefsT4p8RPrjdLq7r lkFKXo2OOB5A0YjJVwrS8BqKIa/F9b9fOPTXIcgziXQPg+122mjeRqR8eDdF/va2Kmf6 GncwpUnMV2MrMg+ggULjQHWCEZX20FXttzQQro5NmmfePZco3MtwdyYjvhH6zsOi3f6K I6cA== 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=ehDXbWE7c2/1x4Hvq0je5a3soIAyc70ylWW5qGoa4JM=; b=LIQCDCeTezW1RJQH0YR2JP4nrMGPocnVzf490G3zS9DQK3rU5U7BDyjda3aPiZHlhG q+0iET/szsSSmxG7t8J6ZnDmeC2b9XfJXSh/J7o4DTIZPT9Gj8/OOHjOK0AsWTuNqHOB aISEFBUkXIwo1KV28ZaU4y29M8lrLyQesxmH9+4h2LA0TSDyGlBwwWg4xsqxhgbLumow OyWlIX+xJp3BrElTkMSQXOXdWGH5CnjVKKoCurNwQSJR4pgiy1ncX8zMZdxQFZzL19fY /yTycI0u42n/Bt4B6YYRWkekv6itXR2RFfKQ/f41hitofbGr0NSPqycfRVklEOPMA6n5 Dl2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=N+w5nxQU; 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 u9-20020a056a00098900b0057629288720si15487738pfg.176.2022.12.27.04.16.02; Tue, 27 Dec 2022 04:16:10 -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=N+w5nxQU; 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 S231670AbiL0MJm (ORCPT + 66 others); Tue, 27 Dec 2022 07:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbiL0MJa (ORCPT ); Tue, 27 Dec 2022 07:09:30 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CD31F7; Tue, 27 Dec 2022 04:09:24 -0800 (PST) X-UUID: 7d1c07a9fcc6484ba22d1dbaf26ce911-20221227 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=ehDXbWE7c2/1x4Hvq0je5a3soIAyc70ylWW5qGoa4JM=; b=N+w5nxQUltUUlZiGWyDMUamNrPa4wB+N4Vtrrto9Ubf2ov5QG5EZcEi4krvqj6sht52Kk/yPe2NdPwgOXNeFcc9FBtUTFxS8jJPQBAEmIPkZALEtRw2ghIJENLxWUYOYep+lgGgsqWCtgIYN+fjTxDFQGrv4OFmppGfBeLrcZPY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:f4834809-8552-48e3-878d-c29f1c661b28,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.14,REQID:f4834809-8552-48e3-878d-c29f1c661b28,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:dcaaed0,CLOUDID:ab94898a-8530-4eff-9f77-222cf6e2895b,B ulkID:221226174310TJMZNJJF,BulkQuantity:16,Recheck:0,SF:38|28|17|19|48,TC: nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:41,QS:nil,BEC:nil,COL:0 X-UUID: 7d1c07a9fcc6484ba22d1dbaf26ce911-20221227 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1283313003; Tue, 27 Dec 2022 20:09:18 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 27 Dec 2022 20:09:17 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 27 Dec 2022 20:09:17 +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 v2 01/13] soc: mediatek: mtk-svs: enable the IRQ later Date: Tue, 27 Dec 2022 20:09:02 +0800 Message-ID: <20221227120914.11346-2-roger.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20221227120914.11346-1-roger.lu@mediatek.com> References: <20221227120914.11346-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 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 0469c9dfeb04..91e06f43969d 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -2379,20 +2379,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", @@ -2414,6 +2400,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