From patchwork Thu Feb 25 14:59:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12104213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC357C433DB for ; Thu, 25 Feb 2021 15:01:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CF1764E83 for ; Thu, 25 Feb 2021 15:01:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CF1764E83 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=V38UQz6jk/4dxncOu4MyAoAEPlIg839+OP5h4taXY1I=; b=29d3nMOMv9tUNRjPVP2u95eyTt Pcjlyjpq2GtY5Wzgo0E/IGWA79gWYpC2PJQej8w8J3UN7MKNYg960dLG7h0zFmjD8RhS6wcqM1jgo d8lCW6Yq5HqhuNR1ym2FOooW4IeEJKaFQ6rn7h7b8vyoN3TDE61vzQaRwzK3A6DxiX4naI56C03NZ HdbeJQisbwCzkYyy0d9WaBydDVoCtj4aNhlb0NmbVbhtQVFWelwo965ACZGeXxFhizqv4UaMfxU2r 3e0liXhAIKeHrl++4DvcLWPQZa7Uyl09ucjuklEz7ZHGkFPbXaoXVqfpKWdicgVIWIrpmAuNxsEc3 ER1UF8dA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFI7a-0003hR-D1; Thu, 25 Feb 2021 15:00:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFI7X-0003gx-Ob; Thu, 25 Feb 2021 15:00:04 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 383B864E83; Thu, 25 Feb 2021 14:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614265202; bh=4wzLdHIu+jiyPmW3PiOzDadifaMBPSqSTbdxzwLIE1c=; h=From:To:Cc:Subject:Date:From; b=G1oBjB6uOoC4UCHfTV2LUsCGDAd0MUJCZE95YTtfWF5Cch4L5tnf75prgLq19fCv1 Zxx6a02DtrC6TzcyNu9066IZV5lBGowkcmlTc6MWj0gqquXzJ4Nca6HENTdXp2HXVQ YQ62sJ27DR/kG3CXW12s+6Mh2ayEePgl8nIZpqciUkFWCTojN5gnydDK1B5a/JhV1j a4mQU/n6dOxQQ5INkCevueTCy2svlyxM6x6wL5P2fw5WMOt9l8UNwojwQXWEljA7mX DJAp5dew5ZMgzfRYGe9Djth9Y4PXO9S15ZM2R+4rGlos00owsJUlV6CxX/8nZCD2N4 xxZHdY6Mwvj6g== From: Arnd Bergmann To: Felix Fietkau , Lorenzo Bianconi , Kalle Valo , "David S. Miller" , Jakub Kicinski Subject: [PATCH 1/2] mt76: mt7915: fix unused 'mode' variable Date: Thu, 25 Feb 2021 15:59:14 +0100 Message-Id: <20210225145953.404859-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_100003_883063_79B93EAA X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryder Lee , Arnd Bergmann , linux-wireless@vger.kernel.org, Sean Wang , Nick Desaulniers , linux-kernel@vger.kernel.org, Nathan Chancellor , clang-built-linux@googlegroups.com, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, Shayne Chen Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann clang points out a possible corner case in the mt7915_tm_set_tx_cont() function if called with invalid arguments: drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:593:2: warning: variable 'mode' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:597:13: note: uninitialized use occurs here rateval = mode << 6 | rate_idx; ^~~~ drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:506:37: note: initialize the variable 'mode' to silence this warning u8 rate_idx = td->tx_rate_idx, mode; ^ Change it to return an error instead of continuing with invalid data here. Fixes: 3f0caa3cbf94 ("mt76: mt7915: add support for continuous tx in testmode") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/mediatek/mt76/mt7915/testmode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index 7fb2170a9561..aa629e1fb420 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -543,6 +543,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) tx_cont->bw = CMD_CBW_20MHZ; break; default: + return -EINVAL; break; } @@ -591,6 +592,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) mode = MT_PHY_TYPE_HE_MU; break; default: + return -EINVAL; break; } From patchwork Thu Feb 25 14:59:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12104241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD7EAC433DB for ; Thu, 25 Feb 2021 15:01:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 717AB64E83 for ; Thu, 25 Feb 2021 15:01:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 717AB64E83 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZOUydwmkW+U/6Mx7Fbt4qD1QRx3IZ7Qa1TpI98l1j1A=; b=J2+xDBND3ak8pynIejQx517DC 6NYw0FvjX//22A31bu6P6VFgvN1qall5dNvyQr76XZzifjtLZaqdpzicxo3tQLhKhcxxGqwPvBFbN 9lSpdepaOlObqWSgJ2zPOFs1wP3N+bIH55BPggc4GaUAAycVokzNY53PttjAZ1gnG3jNhJ1QdCkln JLZlM6FvLT6bIcGWfMicNvYHG6nzaOg+xYFgm8vJKQ6gREtfAlx0sjRvPxeGudQ18dscpAeVixuup 2jBJNk0f3E67sxOe8ILuDKChEYw3QZNybni/qf/FwYX8KDBVekEj0Wo5w/OrwHn7pajvEvWEELMiB xbUMUHH4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFI7z-0003lY-Gj; Thu, 25 Feb 2021 15:00:31 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFI7w-0003ky-RZ; Thu, 25 Feb 2021 15:00:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7024464F17; Thu, 25 Feb 2021 15:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614265226; bh=a/04c2nTy0GlyhPSNi1+WMgFD2zAC0g91qf3en1lMLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEDUqRTCMenTu9MnNcW1qob6RYDrqs1gz1VtBztoWFVDSpAvVZf6RE6B5qU+6cBjk E5A8uOpoJvPVDZhA1IAMy2tUVFJQtfqQLp7LRPNIHbxOk2cRaS61LpZHyWdumt/P+B rWlN1QvnRZkoVsDDP2HjPlbTl5qVm/kU7hb78IywItFArL2p00/n9Sq/7UrkyzGcvH cPbVmKao7NukQmUDujfQcneYHhKc/QWLt10ZMrk8ZHFLEiJo4Gu82nZvidg4q+bdAq ar7EvPI7N8wpkhMcwlUkhr/KdtGe5YaxLdm0qhoq9xB83cMehBHqpRd194JPxe+zQq S6qMO9MKOCzzQ== From: Arnd Bergmann To: Felix Fietkau , Lorenzo Bianconi , Kalle Valo , "David S. Miller" , Jakub Kicinski , Matthias Brugger Subject: [PATCH 2/2] mt76: mt7921: remove incorrect error handling Date: Thu, 25 Feb 2021 15:59:15 +0100 Message-Id: <20210225145953.404859-2-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210225145953.404859-1-arnd@kernel.org> References: <20210225145953.404859-1-arnd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_100028_994948_510AC8B3 X-CRM114-Status: GOOD ( 11.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryder Lee , Arnd Bergmann , linux-wireless@vger.kernel.org, Sean Wang , Nick Desaulniers , linux-kernel@vger.kernel.org, Nathan Chancellor , clang-built-linux@googlegroups.com, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Soul Huang , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann Clang points out a mistake in the error handling in mt7921_mcu_tx_rate_report(), which tries to dereference a pointer that cannot be initialized because of the error that is being handled: drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:409:3: warning: variable 'stats' is uninitialized when used here [-Wuninitialized] stats->tx_rate = rate; ^~~~~ drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:401:32: note: initialize the variable 'stats' to silence this warning struct mt7921_sta_stats *stats; ^ Just remove the obviously incorrect line. Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support") Signed-off-by: Arnd Bergmann Reviewed-by: Nick Desaulniers --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index db125cd22b91..b5cc72e7e81c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -405,10 +405,8 @@ mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb, if (wlan_idx >= MT76_N_WCIDS) return; wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]); - if (!wcid) { - stats->tx_rate = rate; + if (!wcid) return; - } msta = container_of(wcid, struct mt7921_sta, wcid); stats = &msta->stats;