Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2374424lqp; Sun, 24 Mar 2024 16:29:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/kRNP+QjAnXH0pnRas/xru9LADZMGHAHRQw1uQ7asqoT+htf8krZfC3RliEDXZ0Tz6Ygmg9UjxV3pzqeEL5L6OSCbTDRChgQuZ1VA5A== X-Google-Smtp-Source: AGHT+IGyYeYbiwNYTR7MUomqSiukRxfXzjatGOvS6vMDMuHF03awv4zyBnZHsuitvW6Br4SlGWlY X-Received: by 2002:aa7:c48a:0:b0:56c:6cb:e7ad with SMTP id m10-20020aa7c48a000000b0056c06cbe7admr2147542edq.9.1711322979171; Sun, 24 Mar 2024 16:29:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711322979; cv=pass; d=google.com; s=arc-20160816; b=YgQQ3KXNrLjl7VzOUzNJC1KOFiWGxUgNT3kKtkWdWUry2DX5pGEa2YnRD/AguxjgJ8 OkXtVBk8sqOfkrer7nl7Uy9KmGaZ8Ai6iIQAmystRNEgBH7ewAZNo2bDibFvk3hz5NGE Ppx1qusQlzSxF1Ic8d+vLFaKVlPUxkNJmhM3OvIYtt76XB8MD2SZaBv+MGSkSL8LMhFM o8FaV4whz1C+FIADTKdyjCvDV3Alaf3YVp5Sag+z+N7myPWAktLb/Wp/iP8VnjXJIKUp g3Ew6ZY0E3YfDD73wYe7eWa6/kZBxVIyr8GhtigdsnZhZjwIO0isf15oOreylkawVk7R /jUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SvBnLLFGXdIEQBICEiMuFJOQOHF9c7wBBS+nhh5M7OU=; fh=SD/U4G7SvMORAMepeW+/BRYWGGA6yK6gr+HTfp6AA1c=; b=Zb7YuN3Cl8Y4nbwk07CDsOkTF+VDCVqEA3lCSc1i37k8/KmGLzchYprDW+5PSUlPiL 8LgGRR8PJ1gI33IYEE0l9/VnNy43sADdClBez7GAJO6aiokK6AHpdBCi8ZJVJxCw6crO +eTgiWAbazhLUGxuIkwfaJRun9MYsQ4dIAepbDzgQ2VTBs9Gvm5QAOeM9W2vXCt0vvQx a2g1b4Dkflwl4kwzsGbzg2UGXKbK7gyPQN2Scl0udOGoNpVwa9cTBJ5Q49+RALQAuJHC sg7Y6fR8dHsizsAW8EG2DiY5BJjewAX4qAMCJLoUsKeL+7NDoK2c446phqlS10PEhoF1 kzCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nHJkb3SZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113141-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id er8-20020a056402448800b00568d315b83esi1949181edb.10.2024.03.24.16.29.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nHJkb3SZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113141-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113141-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DF0961F2180C for ; Sun, 24 Mar 2024 23:29:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2A6816F26C; Sun, 24 Mar 2024 22:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nHJkb3SZ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D10AB16EC10; Sun, 24 Mar 2024 22:39:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319948; cv=none; b=QazJQjADbkUAbYqKe6I20MoYITAlNMcwVd5H9nhem+0/td5RVAWURxJxidGeszLb6kHrrdKvedrRgodj5obcpY/YPJw6da/wt7BlLaeP1+x1np53lGr8XEbI1zejRuk2+Ihv6+a7YfQdugFHgzBdbfYxa2UXEI7+ewKMtkW/kzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319948; c=relaxed/simple; bh=dKi3U0fdatZ7Ch7IsQNs3ZCbOcFztWAhzn7bV7x69kw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ShF8XkbS73b3a1s7cbJkA7LBPa5DIGa8r/99HRm4ZgxhBEnDlZjoImAnmsfrs40bsuWefs6/GVkvWOZMoX5BfGvJW/rp4V2sLT7yaEQ/IMkc/rR+xVRv4jvNfS7G1cZ47aYaY5BV32/w0qyVX4wdh/AEBSVuYyFb0r1S1Xnpxvc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nHJkb3SZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA7ACC433C7; Sun, 24 Mar 2024 22:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319948; bh=dKi3U0fdatZ7Ch7IsQNs3ZCbOcFztWAhzn7bV7x69kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHJkb3SZiPUghCQGRoi6ZP2Wrvg0N/pifdItanE7+pXaLBk2fEipautjaiinCYY1u HqP5qmpS26dGQcoBDnvTZvQl9AUTyXlmSay0oMXxj6Tnd7ufpHdFiEBPMbvFn6lNTx JxcBXthHIzXjEzb5xbYV0pRZ8up/lw+IfSJ/97axVhYkdycRnagatZjjqQhs07ybHJ 9airokfQaTjyS3LXRqGKRUTrN0wwBe/8yNVLbH1KFE/R4rTniovJ3Th4U7te1Sg8Uy N5djAS0Q8T/moyJBSB+cD0JqshOBHXIn4uI8DtqQZdEjDcxu5pc4M1o5ZTVRzeUXmx 7IvIUQ0YxPXcQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ming Yen Hsieh , Leon Yen , Felix Fietkau , Sasha Levin Subject: [PATCH 6.8 254/715] wifi: mt76: mt792x: fix a potential loading failure of the 6Ghz channel config from ACPI Date: Sun, 24 Mar 2024 18:27:13 -0400 Message-ID: <20240324223455.1342824-255-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ming Yen Hsieh [ Upstream commit 07ce1d46372489d90f9cccebb3277d1af801c4b9 ] In some case, the MTCL table will exist, but MTDS table will not. So the SAR will init fail. This patch make MTCL and MTDS can exist with no dependence. Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support") Signed-off-by: Ming Yen Hsieh Signed-off-by: Leon Yen Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../wireless/mediatek/mt76/mt792x_acpi_sar.c | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c index e7afea87e82e2..8fee3d481df0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c @@ -66,13 +66,15 @@ mt792x_acpi_read(struct mt792x_dev *dev, u8 *method, u8 **tbl, u32 *len) } /* MTCL : Country List Table for 6G band */ -static void +static int mt792x_asar_acpi_read_mtcl(struct mt792x_dev *dev, u8 **table, u8 *version) { - if (mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL) < 0) - *version = 1; - else - *version = 2; + int ret; + + *version = ((ret = mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL)) < 0) + ? 1 : 2; + + return ret; } /* MTDS : Dynamic SAR Power Table */ @@ -166,16 +168,16 @@ int mt792x_init_acpi_sar(struct mt792x_dev *dev) if (!asar) return -ENOMEM; - mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); + ret = mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); + if (ret) { + devm_kfree(dev->mt76.dev, asar->countrylist); + asar->countrylist = NULL; + } - /* MTDS is mandatory. Return error if table is invalid */ ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver); if (ret) { devm_kfree(dev->mt76.dev, asar->dyn); - devm_kfree(dev->mt76.dev, asar->countrylist); - devm_kfree(dev->mt76.dev, asar); - - return ret; + asar->dyn = NULL; } /* MTGS is optional */ @@ -290,7 +292,7 @@ int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default) const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; int i; - if (!phy->acpisar) + if (!phy->acpisar || !((struct mt792x_acpi_sar *)phy->acpisar)->dyn) return 0; /* When ACPI SAR enabled in HW, we should apply rules for .frp -- 2.43.0