Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2807783pxb; Fri, 5 Nov 2021 05:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrWbfZ0U1sJ8shc3rlPkebjaf60W9xLO3l2cJwuuXmd2zt4yUSwHTx35OgSQ/oKlFSKvNi X-Received: by 2002:a17:907:3f8a:: with SMTP id hr10mr10927333ejc.527.1636114166572; Fri, 05 Nov 2021 05:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636114166; cv=none; d=google.com; s=arc-20160816; b=MVYTcG1RWwg4ZI1VRHaZrGTi6Kntv+lqMcHRqRwZIT9BHfyT0KWIrHHaS6X7rk6AXN ElY8XCabgSwTfbifZqlyZasYXKBN4f3HTh2MXqwu/50K5wd+Zhdtr66iuLJeiEALpfZL x2d/yut2dXUsQG8ZWJDb9FVrfd4RvJezhJNyCthejoJIcafEBKCjNm3zP+HeyjozxYoX QpSQtNf+uFf6rYJktn6pI9u61kGpnxhwMaKnwaKhn0OY84f0qZRSrhAhtmeCq6gUvaOC zVTcLFk6hxHSZkr/k9eLw9MjR0faZYkZQQTjKnZhxVfMsx3HNK0KXp5VK1/8fBbUM4RU ydkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=4KnHk6k3AWNccy88di/iFY5jIVn1UTgIzGhMBKbeHVM=; b=juDFV4se1B8dtmTA79oXIwakPN7M/ZzYZVh5ay7sYCfj/pGgile5cFpVMIZFOA3Zz9 pyft44J0VU1hbo0lht2bma8YxL/FahaSN2jYlHEq9O0YSwutU2F/8zhYKg3XZM/N44vn lEQYAmnp+MfiTvSVnGQVpa1fB4HKff4g6ZKSBB6Qd+BFcnMcIPzaiumo1eK6DhqMU6oD ADt5pYltE6H/OYgnn91gaHnqKLo6IccxSkjrchF2rbkDbiutRqgNi129o6vtIxgWeqON x/RIN+KA+thX8QCGXRMFM6Am5ipQb+6RLc1QT88C7lzBmRkvGb/Odev4i0pfr7ALbaTG Xn6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si15345364edj.610.2021.11.05.05.08.59; Fri, 05 Nov 2021 05:09:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbhKEKkU (ORCPT + 67 others); Fri, 5 Nov 2021 06:40:20 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:51790 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229471AbhKEKkT (ORCPT ); Fri, 5 Nov 2021 06:40:19 -0400 X-UUID: 139036895c274dec9fb10600b7920767-20211105 X-UUID: 139036895c274dec9fb10600b7920767-20211105 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1270331354; Fri, 05 Nov 2021 18:37:36 +0800 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 5 Nov 2021 18:37:35 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs10n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 5 Nov 2021 18:37:35 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , "Evelyn Tsai" , linux-mediatek , Shayne Chen Subject: [PATCH v2] mt76: mt7915: fix return condition in mt7915_tm_reg_backup_restore() Date: Fri, 5 Nov 2021 18:37:26 +0800 Message-ID: <20211105103726.4979-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fix the issue that some registers not configured properly after restarting testmode. (e.g. change state from idle to off, and off to idle) Signed-off-by: Shayne Chen --- v2: only need to backup once --- .../wireless/mediatek/mt76/mt7915/testmode.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index 89aae32..af80c2c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -361,16 +361,15 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy) return; } - if (b) - return; - - b = devm_kzalloc(dev->mt76.dev, 4 * n_regs, GFP_KERNEL); - if (!b) - return; + if (!b) { + b = devm_kzalloc(dev->mt76.dev, 4 * n_regs, GFP_KERNEL); + if (!b) + return; - phy->test.reg_backup = b; - for (i = 0; i < n_regs; i++) - b[i] = mt76_rr(dev, reg_backup_list[i].band[ext_phy]); + phy->test.reg_backup = b; + for (i = 0; i < n_regs; i++) + b[i] = mt76_rr(dev, reg_backup_list[i].band[ext_phy]); + } mt76_clear(dev, MT_AGG_PCR0(ext_phy, 0), MT_AGG_PCR0_MM_PROT | MT_AGG_PCR0_GF_PROT | MT_AGG_PCR0_ERP_PROT | -- 2.25.1