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: 387222 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp380195jap; Thu, 25 Feb 2021 07:01:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4UAKelvYVNEAAK5UOoKBD/D5fVIjg7aGwZ7toslWMkNdpI6xJS8qneWHHQiKuY/MpzBYM X-Received: by 2002:a17:906:1712:: with SMTP id c18mr3033428eje.417.1614265283790; Thu, 25 Feb 2021 07:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614265283; cv=none; d=google.com; s=arc-20160816; b=E9KzqUseDn/fyLhrsW+Jg2CmXzZYK5OkCmaZQk8Aw7AgzpLjOEZioWWdnDCmyco0rp rRNVBtnuso/YhRwa/1ZXULDKlt/KVptBj7IGAdIH3Ct01adZyXtv6KdLQ/UAtC4d8g7f /45wcut9jP5dpDtVBfjT1y4SrEF5XPRQJ5FC1c5MZxeFruWpD92aMGW8jCDvprfXK3cw QHVOD4+pOjbTeICqFWXVgVXb63pkokjmG8XLhFWYZtNpn4F7AJwXoVfL/4AbP/twieYp 839Y4gAOribXyZYwDkwI/IZtoXpD71ghzE67ayGRtJ8tu1S0O1sQX73kviC6EB+363fd tmaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=df33HWbn+fxg2DNdIFy9+ptcH+KE6zR/8BKqLJi6bC0=; b=WD62J0sHmMHPegawQuXJ8XTtnuRIBgStRIwVRTx0oJ7ljUCqGfU3rB4AcHYbXRrmW7 gQL7ncivVD7YXXuLBiImc/6Lm3zEmoBRtNa5VlpJYvcxNVuBJcYTFSDfMZAhd085GAK+ iYsimZ76ei7qLGioFnvNHWS6FGPeDEergcKvxt5q9kpf3op86xAJwqvcGoWkpoL3gGWN DCluYSLBoN+UKfI2SM0eI0+5KZzT1PQWj9mm48Hkvb32FxIg3nAAN4BebggNTTsK3vMQ 5SZjr1AOjdDx74MJjgfWVCzTPbK/XNdnAWbiLPfud85TDYPxFUbZyBGUXwgRq9OAtTdd 1QSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G1oBjB6u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb17si3394249edb.79.2021.02.25.07.01.23; Thu, 25 Feb 2021 07:01:23 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G1oBjB6u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbhBYPBF (ORCPT + 2 others); Thu, 25 Feb 2021 10:01:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:35874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232033AbhBYPAn (ORCPT ); Thu, 25 Feb 2021 10:00:43 -0500 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 Cc: Arnd Bergmann , Ryder Lee , Matthias Brugger , Nathan Chancellor , Nick Desaulniers , Shayne Chen , Sean Wang , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com 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 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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(+) -- 2.29.2 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: 387224 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp381823jap; Thu, 25 Feb 2021 07:02:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdABXMDcbbatKD4MVw0ESIBsTivwYCZ8g7woe4/7pbIWE9yMcQeOpSDEcgqW3V58OtkT6Q X-Received: by 2002:a17:906:fb14:: with SMTP id lz20mr3055437ejb.391.1614265377357; Thu, 25 Feb 2021 07:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614265377; cv=none; d=google.com; s=arc-20160816; b=GMA3+BxdvM5R137zrrTk5YzsE5GSOCQr/AoSTn0zUdJ9AlRg9l3hxbS+l1SVvdVy3S 6vp8nYZ+q7+HhusqgLfUribdfYzimTKhWn8MNhwq92B9DkQ/HcHzNlmF9qexUYUCL44+ EVNBiFL10Qz7/cLlCDnA/z46mPBlYHo9H3p8cQdX1xm2MkfV2XeWpAxYCBqV7KaEMNXr 2HTYktgV1llFwL6JbLzo0A2R7/NLLhKN9PqDYrHbef/n+8aI7tnTf/CgiYXhzbKP94K9 pjotD1sMeRLSLKlmG5hndUeFZ0RMmODW7KeqD3W+3+9pfIseIHQ0+JRo2ogwcwWnQGIw c82A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/Yf9wUTQ/JmrWELXaZeFXgI2z/QAkTfKMz/qKdb3N6g=; b=xf8bQZhepJ6NFYOhTRZOWRrbNd5ZbCLjfzVeSxVRAyujyGfkBBCdqHVYE/jKUmNSON 79ULNvWsPbOR+E2HSpKTfHao7CvSIntu2gSM62HTgFbN8bzGUVQ4dv5MXMuv1w2O8IV0 UUG55OcHLzZiGv2nVB/qhFlIdgbkxKP4+6Ecjs36ePT9TlkQQQtOZbK4PNa1gsqtKVMa CJ3du9zRNgxK4/uDYBKnUIMmfP2TaD/ZUDUmILNt9jPaWgI83gI5vAJhUuGNSfS5g6Ki OmDPLDecplB1Tn8kT0BWZDfuDJnZwqU+gzsLbNuMsLs/zJIF3En7NPYQ1Oo03yb8V6N+ JRZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LEDUqRTC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si3623595ejz.220.2021.02.25.07.02.57; Thu, 25 Feb 2021 07:02:57 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LEDUqRTC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232350AbhBYPBW (ORCPT + 2 others); Thu, 25 Feb 2021 10:01:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:36056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232296AbhBYPBH (ORCPT ); Thu, 25 Feb 2021 10:01:07 -0500 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 Cc: Arnd Bergmann , Ryder Lee , Nathan Chancellor , Nick Desaulniers , Sean Wang , Soul Huang , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com 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 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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 --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.29.2 Reviewed-by: Nick Desaulniers 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;