Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1568328rwi; Mon, 10 Oct 2022 19:08:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KoGp6ayEp+7QmmbLp5dRZHkNQlI8dWeGXcj9DbTsCDuYhw+m1CQInGBrFpYmwtGdbaBCe X-Received: by 2002:a17:907:318b:b0:740:33f2:9e8 with SMTP id xe11-20020a170907318b00b0074033f209e8mr17206352ejb.138.1665454137052; Mon, 10 Oct 2022 19:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665454137; cv=none; d=google.com; s=arc-20160816; b=oj/CgMx1Wx/Mbo2G0CYbqymHz3aE+51XytUcBTAn639ojfM9TT40jqkHSg+l/oU7N7 RnM7dyMEJ417AzxjDEwShSVe2mxfoW3DtRLmR1r4VLNArkvY24owkH9wz/qdDOCyAoTB fMAX/Uyc4WDpx78PSnH8IAARPw/Lce5UqencjGeVJiBeT8dKaB9knjx3luMTg1KeQMCr BYU7T6xkQhSWvSfIIrUtWAId3PszHigJDiDqfwg+13GUDBqdfMQSjrlmSNbF6TpaX6Jw KOr99CgdU+tv967RmQpK+lNf7y0oWGYM7drstQlBgj2hwxneXqDrMmbdEnFlgYiq6tu2 YcXg== 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 :dkim-signature; bh=CxXP6CzobnL6sVNisn2kNutVrGf5dAauzM+XPwU5cAc=; b=WloBH5tKFs9TLS3QFQKC6Ao9ufP0WYMlLvGzcaUCrA+3dLw8mnsNenvh3MUoJfjHKo Jl/dj+TXyohaPc60I+a3JCBYxeKntURovWaAGsAv7J7S49HQ9hcrOx3whHlMHSXgUPwf l+0ibewjhiPhuJfndBgCDeGJbHECLGeyN7rGaqUhChBRmtq6TMB1gjjgZ8fvcyHi+faR zRQqv2xwu8+DfKWHcX23KoEcYDzghn+1847D7wSfMxQnWnuV44f94W3sgrqfrWnCtJw8 nLzoFSdxbr37TQ8Aoi2/RbWstBlofNGZKCPS7qftGpwNiktVcNYGmcnSP8PN5dA1LLIH Bk4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bEQRRGuJ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 hb11-20020a170907160b00b007707ab4be23si13444376ejc.560.2022.10.10.19.08.39; Mon, 10 Oct 2022 19:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=bEQRRGuJ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S229701AbiJKCED (ORCPT + 61 others); Mon, 10 Oct 2022 22:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiJKCEB (ORCPT ); Mon, 10 Oct 2022 22:04:01 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA4682865 for ; Mon, 10 Oct 2022 19:04:00 -0700 (PDT) X-UUID: 35ca98a640d540d090ff832d572fcd56-20221011 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=CxXP6CzobnL6sVNisn2kNutVrGf5dAauzM+XPwU5cAc=; b=bEQRRGuJo47tAq44Qf+ExrlWkzc4cILvjdl5NzZU+RcHq6mVTf6Otu6/ouOEySRXQS6eTkO2mGOueFyFkYXKXCPpy2T95UZSSp0FEQYD4KEleNNJaogDXj882u01w4H/9rxuv17j3dnQbbPQqSsOrQWJfp6eQcxc0kDITIpOn9g=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:7f52eaa1-959d-4f49-9fd4-3df1190fe381,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:-32768,SF:-32768,FILE:0,BULK:-32768,RULE:Rel ease_Ham,ACTION:release,TS:-5 X-CID-META: VersionHash:39a5ff1,CLOUDID:49e50901-cdeb-479d-93af-53f947adce9d,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 35ca98a640d540d090ff832d572fcd56-20221011 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 48326364; Tue, 11 Oct 2022 10:03:46 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 11 Oct 2022 10:03:44 +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, 11 Oct 2022 10:03:44 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH] wifi: mt76: mt7915: prevent unexpected nss setting from eeprom Date: Tue, 11 Oct 2022 10:03:43 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.0 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,URIBL_CSS 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-wireless@vger.kernel.org Add a check to prevent unexpected nss configuration from eeprom. Fixes: 4d8053df67c5 ("wifi: mt76: mt7915: rework eeprom tx paths and streams init") Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c index e2482c65d639..6c5155223087 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -191,7 +191,6 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, path = 4; /* read tx/rx stream */ - nss = path; if (dev->dbdc_support) { if (is_mt7915(&dev->mt76)) { nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, @@ -206,6 +205,11 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, if (!is_mt7986(&dev->mt76)) nss_max = 2; + + if (!nss) + nss = nss_max; + } else { + nss = path; } nss = min_t(u8, min_t(u8, nss_max, nss), path); -- 2.36.1