From patchwork Wed Aug 23 18:23:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 13363036 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B315BC6FA8F for ; Wed, 23 Aug 2023 18:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238106AbjHWSYi (ORCPT ); Wed, 23 Aug 2023 14:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231203AbjHWSYi (ORCPT ); Wed, 23 Aug 2023 14:24:38 -0400 Received: from forward101b.mail.yandex.net (forward101b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D13B4CC7 for ; Wed, 23 Aug 2023 11:24:31 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:790e:0:640:fcb1:0]) by forward101b.mail.yandex.net (Yandex) with ESMTP id BECD860076; Wed, 23 Aug 2023 21:24:28 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id ROPbM94DYCg0-Hj7JIhgF; Wed, 23 Aug 2023 21:24:28 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1692815068; bh=TvS7oPewsHvRj7cHCJ31B6RJrpHBvd2uEQans5lKIuI=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=bGq3q9lhkUrGXPSjmYitT+MXPenxP/IponbNEFEKNSk7dMzv7r/XRV7uNAxD7c/dH BUaksTcCeHz61Wfus32Qg0Uz9nJARriV8dVRq3cBOClZFqgDcfeZxozNQdF5GJ09Ml Q8a9zIKt+WtsDM26uiYUvvvvpF3zc8NOmuZF1Llc= Authentication-Results: mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 1/2] wifi: ath9k: simplify ar9003_hw_process_ini() Date: Wed, 23 Aug 2023 21:23:33 +0300 Message-ID: <20230823182401.196270-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <574813ed-b9aa-458f-9758-29662eb60689@quicinc.com> References: <574813ed-b9aa-458f-9758-29662eb60689@quicinc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Since commit 8896934c1684 ("ath9k_hw: remove direct accesses to channel mode flags") changes 'ar9550_hw_get_modes_txgain_index()' so it never returns -EINVAL, and 'ar9561_hw_get_modes_txgain_index()' never returns negative value too, an extra check in 'ar9003_hw_process_ini()' may be dropped. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov Reviewed-by: Jeff Johnson Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index a29c11f944a5..4731e6618209 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -925,9 +925,6 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, modes_txgain_index = ar9561_hw_get_modes_txgain_index(ah, chan); - if (modes_txgain_index < 0) - return -EINVAL; - REG_WRITE_ARRAY(&ah->iniModesTxGain, modes_txgain_index, regWrites); } else { From patchwork Wed Aug 23 18:23:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 13363037 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C886C3DA6F for ; Wed, 23 Aug 2023 18:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238107AbjHWSYj (ORCPT ); Wed, 23 Aug 2023 14:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238104AbjHWSYi (ORCPT ); Wed, 23 Aug 2023 14:24:38 -0400 Received: from forward100c.mail.yandex.net (forward100c.mail.yandex.net [178.154.239.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF743CE6 for ; Wed, 23 Aug 2023 11:24:34 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:790e:0:640:fcb1:0]) by forward100c.mail.yandex.net (Yandex) with ESMTP id 3AD296006A; Wed, 23 Aug 2023 21:24:31 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id ROPbM94DYCg0-N3uGUmJR; Wed, 23 Aug 2023 21:24:30 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1692815070; bh=WqK+ZXtMSoDEe5DZJSYCZVwD7vC/XhwLm31MSa6iSCw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=KpIyJg9TbyabKfifUf9s8o/Qn8Fy0zJVsvu+IXkoLNRAxrbC1x0c1XKMZmHd+O8b9 lheQXougiM0p3yOg0BEipTAQNHvrRhRJl657KpTeWjWCeGLD9bZjLpYeb5+qBpwqFx Axwi870ZYe8PHkDP/3Mbsjrx7qSx7oZKuRn6DALM= Authentication-Results: mail-nwsmtp-smtp-production-main-85.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 2/2] wifi: ath9k: use u32 for txgain indexes Date: Wed, 23 Aug 2023 21:23:34 +0300 Message-ID: <20230823182401.196270-2-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823182401.196270-1-dmantipov@yandex.ru> References: <574813ed-b9aa-458f-9758-29662eb60689@quicinc.com> <20230823182401.196270-1-dmantipov@yandex.ru> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Since both 'ar9550_hw_get_modes_txgain_index()' and 'ar9561_hw_get_modes_txgain_index()' never returns negative values, prefer 'u32' over 'int' and adjust 'ar9003_hw_process_ini()' accordingly. Suggested-by: Jeff Johnson Signed-off-by: Dmitry Antipov Reviewed-by: Jeff Johnson Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 4731e6618209..6274d1624261 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -766,10 +766,10 @@ static void ar9003_hw_prog_ini(struct ath_hw *ah, } } -static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah, +static u32 ar9550_hw_get_modes_txgain_index(struct ath_hw *ah, struct ath9k_channel *chan) { - int ret; + u32 ret; if (IS_CHAN_2GHZ(chan)) { if (IS_CHAN_HT40(chan)) @@ -791,7 +791,7 @@ static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah, return ret; } -static int ar9561_hw_get_modes_txgain_index(struct ath_hw *ah, +static u32 ar9561_hw_get_modes_txgain_index(struct ath_hw *ah, struct ath9k_channel *chan) { if (IS_CHAN_2GHZ(chan)) { @@ -916,7 +916,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, * TXGAIN initvals. */ if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) { - int modes_txgain_index = 1; + u32 modes_txgain_index = 1; if (AR_SREV_9550(ah)) modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan);