From patchwork Tue Nov 14 13:33:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hejunhao X-Patchwork-Id: 164902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1860261vqg; Tue, 14 Nov 2023 05:34:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IENfv8fLC5fYR2Hw4E1XoT7F5ShL4D8UENPqiYz0BgPjm5bgmi4ocdRXmTHqnqTQgC6xWNB X-Received: by 2002:a17:902:e88f:b0:1cc:e76d:e7b2 with SMTP id w15-20020a170902e88f00b001cce76de7b2mr2599591plg.22.1699968863340; Tue, 14 Nov 2023 05:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699968863; cv=none; d=google.com; s=arc-20160816; b=aW0jFv/4BfFPQanfaVyyfWYqL+tgr6KViDTntfXCtP6SpzWNkabKIaUT6OLMTlo20x +fjb72nHQYSK2Logc55O0GKmjB1WI6PBBlS/bHDt2kVdBnFfEpAi2eT4KMY+dFp3TKHZ g1GwTxKHOCIkOQkKA1vzGGdxupr/miSb31PXFupAmK2ggq8wRZYAoo5u+uM2Shl3oLoH pqqTcXIldjK+w4cZRdtIYfRAMZH3huSVeeyGCtbHDef/ZpLeOuFceH6PPVfxf/nAYCAv EX9BLsy6ZphUVLrWlXCvUyeYDOTFKxSmGf86ysXIQ20y+HxModr7R7+P3beciUJ1eYjB R2Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3bYbdl2ypu6dy29DPHfXliEfTolGe6mEDVcTrbOZLBM=; fh=UHVmWfYpaOpxa5MpZWIHTe5DQ4x7tAMNH9bJWvQ5U9A=; b=okBJ6f9O8Ib8SXzMmDW8XDVb3l+WQHiVTilKUMAl3mr7Z8O8pRckMseNzsJ06pVxgC sKj6QP2mIs6+4BvgjPOybKIBw6qoW+jEJrbubFd/OBW+iAjLAWBlz0VPhlO6LUsnQjRW dy2ReMNgwdR6YEJza2AWa5B8baeYHEqLAeUKoRd8HFSCK14URCT3ktY23cq5dbPxB8AF Bzisna4u8ODTiPvGFJgo8Dn2IpoQdKiWT4r56e35bEgBUm5GE9L8oVy2ZhHAzqU3aB6S gDbYDO80+HN552z2RoLnF84eTgZHv6MNw9zPUSUWrG5xmn0xIWQ/8vXu3kMDI2B8yIeL ykZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u11-20020a170903124b00b001ce2fc160f9si3057270plh.424.2023.11.14.05.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:34:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B5BAF80407F4; Tue, 14 Nov 2023 05:34:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233296AbjKNNdt (ORCPT + 29 others); Tue, 14 Nov 2023 08:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233256AbjKNNdm (ORCPT ); Tue, 14 Nov 2023 08:33:42 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EA001BC for ; Tue, 14 Nov 2023 05:33:37 -0800 (PST) Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SV6b74kgmzPpHw; Tue, 14 Nov 2023 21:29:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpeml500002.china.huawei.com (7.185.36.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 21:33:35 +0800 From: Junhao He To: , CC: , , , , , , , , Subject: [PATCH v3 3/4] coresight: ultrasoc-smb: Fix uninitialized before use buf_hw_base Date: Tue, 14 Nov 2023 21:33:45 +0800 Message-ID: <20231114133346.30489-4-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114133346.30489-1-hejunhao3@huawei.com> References: <20231114133346.30489-1-hejunhao3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500002.china.huawei.com (7.185.36.158) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 14 Nov 2023 05:34:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782546551239421150 X-GMAIL-MSGID: 1782546551239421150 In smb_reset_buffer, the sdb->buf_hw_base variable is uninitialized before use, which initializes it in smb_init_data_buffer. And the SMB regiester are set in smb_config_inport. So move the call after smb_config_inport. Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") Signed-off-by: Junhao He Reviewed-by: James Clark --- drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c index 2f2aba90a514..6e32d31a95fe 100644 --- a/drivers/hwtracing/coresight/ultrasoc-smb.c +++ b/drivers/hwtracing/coresight/ultrasoc-smb.c @@ -477,7 +477,6 @@ static int smb_init_data_buffer(struct platform_device *pdev, static void smb_init_hw(struct smb_drv_data *drvdata) { smb_disable_hw(drvdata); - smb_reset_buffer(drvdata); writel(SMB_LB_CFG_LO_DEFAULT, drvdata->base + SMB_LB_CFG_LO_REG); writel(SMB_LB_CFG_HI_DEFAULT, drvdata->base + SMB_LB_CFG_HI_REG); @@ -587,6 +586,7 @@ static int smb_probe(struct platform_device *pdev) if (ret) return ret; + smb_reset_buffer(drvdata); platform_set_drvdata(pdev, drvdata); spin_lock_init(&drvdata->spinlock); drvdata->pid = -1;