From patchwork Sat Oct 21 08:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hejunhao X-Patchwork-Id: 156407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp184119vqx; Sat, 21 Oct 2023 01:38:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2nn6QHPqzCzXdUbPArKv4o8qcEjzgA6e6FToC0KN8G0kj4F7J7rMynggFh3GwTiWnsE24 X-Received: by 2002:a92:d9ce:0:b0:351:5b43:5ecd with SMTP id n14-20020a92d9ce000000b003515b435ecdmr3895662ilq.14.1697877516843; Sat, 21 Oct 2023 01:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697877516; cv=none; d=google.com; s=arc-20160816; b=olc8HqQDzo7Ts1QeJVsPC8a1u51RfnYTgY5g7paZYv2qzNDxt6yIDveQtF8BHtAZkH 39EmlhR3FgeVdPfLsC6jCx9JHDccaCJkAq1neJYnCJkGYhZeEqaiNTgFfECQoXPSe1+w ZynjFA8jbNAoOonRVOg9mw0EO5gtUexXvMVsnh9nw9UZMc+KpXW6Ax79VDct8NdYks4q 0tHte+XD+/AD4YtBonQA9AsnzGAeAdTq020jsmOsl+aSiBNSrkAuvov58y+h5W/7cRbF BURQD1A/d/RWG6nFWufg59CrZUnN6+wyP5IbAxCl1Ph2JrCI21sqG23IBiYaOWIVzcKn 6v8w== 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=v18oi5fyN+vWPqIR2zE2qp/SfYx/0G4xd8iCFHqGL1s=; fh=DAAgJLf4s0smpgJqxZKr7c0el7KScJ0FbfhkC9eFTa4=; b=E37wO1qsvdEftXTJ6IW0PUG3NxvKYUiTCeE593A+Dw0MV9K6DJkh9FBD7ab7GHXXMY HbaEJ1Ll/g6sMX6S1w0fzaZjgLqCK/qskfULTCF+So06VcGxeZarzh8cFFe9O+qf8d9d wwPoOUKM4/3iiysnNsPDUTnKnvoVXpcOWybm8PHaMClngFSxKsAihBKQrtxWlftK4DSH loowdQxFFHUhPuN6oouf+ccxEF1M8LUlXZOitm7UQ6xuIeffpGlplXJtW50pCv+/nKaJ RqhRIxvBEeIrlmiyJS57Ot4up3ayIUiGZ3JqQFV4hIcHlyGq7W1i92tFQur+qo7DQvmk O/Bw== 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s4-20020a170902ea0400b001bc1b018950si3278517plg.442.2023.10.21.01.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 01:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id C7C8780990ED; Sat, 21 Oct 2023 01:38:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjJUIiD (ORCPT + 26 others); Sat, 21 Oct 2023 04:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjJUIiA (ORCPT ); Sat, 21 Oct 2023 04:38:00 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A3AD5E for ; Sat, 21 Oct 2023 01:37:57 -0700 (PDT) Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SCF8L18s6zcd4q; Sat, 21 Oct 2023 16:33:06 +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; Sat, 21 Oct 2023 16:37:53 +0800 From: Junhao He To: , CC: , , , , , , , Subject: [PATCH v2 3/4] coresight: ultrasoc-smb: Fix uninitialized before use buf_hw_base Date: Sat, 21 Oct 2023 16:38:21 +0800 Message-ID: <20231021083822.18239-4-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231021083822.18239-1-hejunhao3@huawei.com> References: <20231021083822.18239-1-hejunhao3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Sat, 21 Oct 2023 01:38:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780353615383450054 X-GMAIL-MSGID: 1780353615383450054 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 --- 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 c61450f74cb1..2ee6bf5b725e 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;