Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1857705rwd; Mon, 15 May 2023 04:12:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+R+F/eUQb9PPxFjKTUNV+5sCRsMcKQCUX2eAlvuna+jPVvzO3zZgeQT4oVhdaksXb5csf X-Received: by 2002:a17:90a:6046:b0:252:89e6:dea9 with SMTP id h6-20020a17090a604600b0025289e6dea9mr14919003pjm.37.1684149158634; Mon, 15 May 2023 04:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684149158; cv=none; d=google.com; s=arc-20160816; b=CYxuArTYMJD0jj6rlm14tVu+1bwrsBB0ye0S88HCOIGok1TrqMVOiNBrxTfno/kiPR iUaA02lRxTlaNWHhHHt3F82AWMd6wCc5/oKQW6wqbNjH/nEb+KEwPVFfjFGJf7pXT6F2 9A+KOjX0l37UfKGRWtLPavfRCHcS7lwIRfoKj+vKU2RapAhvjoS8RBzJIxtxSFJ/x0ID iGUYNAmPJF+D7iCx3JZaBimzIIRjON74r0o/yV21s712cGg3PdiIF5qYAAvsBFhwUeOg /kmI0TzjqTuP5S8Nb4niRNilOE8TEfz+xYe0u1CWS7JiU8UoVoQCZMkIjBOgZm9uI3Fg VcAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=E0LN/VMhxIO+mkMq1hZOXfEntsjEgt6pesvvS8/5P4Y=; b=Fuq57sO4m2Vy6IxeZCbeuwWrUHYEVYUn6QLKTVyh45ftENEnv3bO+OV/wLjpSwWryb DkxUvfbvEZgD5+zOHj0CoyD+1Llhg+GQO5bx+JWtxlaGsRPFxNBI+fJS8uUV0Y4FJb84 xnboYFKs0oGY5Jiy+31xDwLMfIb1ImXTDRDJnfLU1+iT2PyXoLuB2xojqmDyKM5XyAAc gt+S/UCsOlO7P+RtLTvwUcoIEaYJE/6f2oTiCzmlDj9HL2osoZuqLPumCvdGN5awbg9J Pc6Uq7PYmliW9NIBT9kIVtozcV+/Lo6YjIQozBRGZRBw11eS19g8bzft34Bk/VoBcE5W lKzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q5ffqkbJ; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a17090ace8d00b0025039190c8dsi23125560pju.166.2023.05.15.04.12.31; Mon, 15 May 2023 04:12:38 -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=@kernel.org header.s=k20201202 header.b=q5ffqkbJ; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241158AbjEOLIk (ORCPT + 61 others); Mon, 15 May 2023 07:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241163AbjEOLIi (ORCPT ); Mon, 15 May 2023 07:08:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DC521737; Mon, 15 May 2023 04:08:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6AA16227B; Mon, 15 May 2023 11:08:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EBB3C433EF; Mon, 15 May 2023 11:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684148911; bh=olj9SocFR66EhLbf+VVLOl+zHXsxnZV4TDEkh6zL2MY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=q5ffqkbJfJH6tWfcBgdyCtzwgvmkFwV053vTKMs3YyZmiU5Y8p2btlgz4tGp8KF/R eQjK47v3+X3i222Euu8FijpFyP6Nux6pb+v4mqUszuRsT+9b8ebRl7RlQJguigbMDL BKqGQfmG0k1BT9oDUs2PSRk14FWIylwQf6mg3sDBQrMWhJePOaNOtmwK0T8pgA0GQE XczazgE+oqu70oDAJoBURTzKrgIdZVgPlKyQvEiypT1a8gZJtVLijr4AfSfRUqtWaa gu1sKTtNlutfPiEOJxu6ksFTDSE2WHfb1Eh2c20oLv+uQ/ujIemijRp4G9IL2eufEn THunG5weEt55A== From: Kalle Valo To: Daniel Golle Cc: Simon Horman , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Alexander Couzens , Sujuan Chen , Bo Jiao , Nicolas Cavallari , Howard Hsu , MeiChia Chiu , Peter Chiu , Johannes Berg , Wang Yufen , Lorenz Brun Subject: Re: [PATCH] wifi: mt76: mt7915: add support for MT7981 References: Date: Mon, 15 May 2023 14:08:22 +0300 In-Reply-To: (Daniel Golle's message of "Sun, 14 May 2023 18:32:15 +0200") Message-ID: <87ednhn97d.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Daniel Golle writes: > On Sun, May 14, 2023 at 04:53:43PM +0200, Simon Horman wrote: >> On Sat, May 13, 2023 at 03:35:51PM +0200, Daniel Golle wrote: >> > From: Alexander Couzens >> > >> > Add support for the MediaTek MT7981 SoC which is similar to the MT7986 >> > but with a newer IP cores and only 2x ARM Cortex-A53 instead of 4x. >> > Unlike MT7986 the MT7981 can only connect a single wireless frontend, >> > usually MT7976 is used for DBDC. >> > >> > Signed-off-by: Alexander Couzens >> > Signed-off-by: Daniel Golle >> >> ... >> >> > @@ -489,7 +516,10 @@ static int mt7986_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie) >> > rg_xo_01 = 0x1d59080f; >> > rg_xo_03 = 0x34c00fe0; >> > } else { >> > - rg_xo_01 = 0x1959f80f; >> > + if (is_mt7981(&dev->mt76)) >> > + rg_xo_01 = 0x1959c80f; >> > + else if (is_mt7986(&dev->mt76)) >> > + rg_xo_01 = 0x1959f80f; >> >> Hi Daniel, >> >> rg_xo_01 will be used uninitialised below if we get here >> and neither of the conditions above are true. >> >> Can this occur? > > No, it cannot occur. Either of is_mt7981() or is_mt7986() will return > true, as the driver is bound via one of the two compatibles > 'mediatek,mt7986-wmac' or newly added 'mediatek,mt7981-wmac'. > Based on that the match_data is either 0x7986 or 0x7981, which is then > used as chip_id, which is used by the is_mt7981() and is_mt7986() > functions. But what if later more changes are made, for example a third compatible is added? It would be good to add a warning or something else to protect that. And I would not be a surpised if a compiler or static analyser would even warn about the uninitialised variable. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches