From patchwork Tue Aug 1 04:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 709574 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 2F3CDC00528 for ; Tue, 1 Aug 2023 05:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229993AbjHAFAN (ORCPT ); Tue, 1 Aug 2023 01:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjHAFAL (ORCPT ); Tue, 1 Aug 2023 01:00:11 -0400 Received: from forward102a.mail.yandex.net (forward102a.mail.yandex.net [178.154.239.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 654051FC0 for ; Mon, 31 Jul 2023 22:00:08 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:170e:0:640:d60c:0]) by forward102a.mail.yandex.net (Yandex) with ESMTP id CCD7446D44; Tue, 1 Aug 2023 08:00:05 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 40Ji1unDfW20-sjL1kzYh; Tue, 01 Aug 2023 08:00:05 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1690866005; bh=GSsKorbx5RHJKMUhD6krP0e+LaWLX/fDEBFkpcT41kY=; h=Message-ID:Date:Cc:Subject:To:From; b=pitjjJdCXYp1+L3VCuu2u/HU1W9x6ovyToYbq4xa8+/L03n0c8W4ILQ8j3wlI1QB5 AULqhbDgog3K2yjD8S/uWEwu/ow407fXaOVCHvvXUuQ69Bi9vtVMxKrn+qLfoO+d89 td7OwGiIkJXJA610tq4S9Gd4eiyzA7FN+xhJAU6I= Authentication-Results: mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Felix Fietkau Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 1/4] wifi: mt76: handle possible error returned by sdio_set_host_pm_flags() Date: Tue, 1 Aug 2023 07:57:20 +0300 Message-ID: <20230801050000.18864-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In 'mt7663s_suspend()', drop nested declaration of 'err' and handle possible error returned by 'sdio_set_host_pm_flags()'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/mediatek/mt76/mt7615/sdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c index fc547a0031ea..6607577d22cf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio.c @@ -188,14 +188,14 @@ static int mt7663s_suspend(struct device *dev) if (!test_bit(MT76_STATE_SUSPEND, &mdev->mphy.state) && mt7615_firmware_offload(mdev)) { - int err; - err = mt76_connac_mcu_set_hif_suspend(&mdev->mt76, true); if (err < 0) return err; } - sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); + err = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); + if (err) + return err; err = mt7615_mcu_set_fw_ctrl(mdev); if (err) From patchwork Tue Aug 1 04:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 709154 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 02A44EB64DD for ; Tue, 1 Aug 2023 05:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjHAFAM (ORCPT ); Tue, 1 Aug 2023 01:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjHAFAL (ORCPT ); Tue, 1 Aug 2023 01:00:11 -0400 Received: from forward101a.mail.yandex.net (forward101a.mail.yandex.net [178.154.239.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E551FC3 for ; Mon, 31 Jul 2023 22:00:09 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:170e:0:640:d60c:0]) by forward101a.mail.yandex.net (Yandex) with ESMTP id 2D5BD46C76; Tue, 1 Aug 2023 08:00:07 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 40Ji1unDfW20-Ox7efaRJ; Tue, 01 Aug 2023 08:00:06 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1690866006; bh=W5W7rPkOZCjf4eEXAecF+cJutWQYN7zZF7eEwmOs6zQ=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=jhddqpnvmCXdXXllRhyORPvrF7fxbqEqlI5ksG449oHtTQKwzE5mdc6VO7RkEEKBa 1qmH3TwKqwxmoggMIIhTLU0zdOJqnAlNLN0Nxy9QbmZctyDCHuXd/jg+ERB9ESLFff xUdVjbdNhjwwIeoF8xxRX8d+qK1ZWPZOrgjLhA/o= Authentication-Results: mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Felix Fietkau Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 2/4] wifi: mt76: handle possible hardware timeout in mt7603_pse_client_reset() Date: Tue, 1 Aug 2023 07:57:21 +0300 Message-ID: <20230801050000.18864-2-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801050000.18864-1-dmantipov@yandex.ru> References: <20230801050000.18864-1-dmantipov@yandex.ru> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Handle possible 'mt76_poll_msec()' timeout in 'mt7603_pse_client_reset()', convert the latter from 'void' to return 'int', propagate return value to 'mt7603_dma_init()' and 'WARN_ON()' on it in 'mt7603_mac_watchdog_reset()'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/mediatek/mt76/mt7603/dma.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 16 ++++++++++------ .../net/wireless/mediatek/mt76/mt7603/mt7603.h | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c index 03ba11a61c90..15c6564f212a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c @@ -169,7 +169,9 @@ int mt7603_dma_init(struct mt7603_dev *dev) MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); mt76_wr(dev, MT_WPDMA_RST_IDX, ~0); - mt7603_pse_client_reset(dev); + ret = mt7603_pse_client_reset(dev); + if (ret) + return ret; for (i = 0; i < ARRAY_SIZE(wmm_queue_map); i++) { ret = mt76_init_tx_queue(&dev->mphy, i, wmm_queue_map[i], diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c index 12e0af52082a..fe38b9a8034d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -1367,7 +1367,7 @@ void mt7603_mac_stop(struct mt7603_dev *dev) mt76_clear(dev, MT_WF_ARB_RQCR, MT_WF_ARB_RQCR_RX_START); } -void mt7603_pse_client_reset(struct mt7603_dev *dev) +int mt7603_pse_client_reset(struct mt7603_dev *dev) { u32 addr; @@ -1383,20 +1383,24 @@ void mt7603_pse_client_reset(struct mt7603_dev *dev) /* Start PSE client TX abort */ mt76_set(dev, addr, MT_CLIENT_RESET_TX_R_E_1); - mt76_poll_msec(dev, addr, MT_CLIENT_RESET_TX_R_E_1_S, - MT_CLIENT_RESET_TX_R_E_1_S, 500); + if (!mt76_poll_msec(dev, addr, MT_CLIENT_RESET_TX_R_E_1_S, + MT_CLIENT_RESET_TX_R_E_1_S, 500)) + return -ETIMEDOUT; mt76_set(dev, addr, MT_CLIENT_RESET_TX_R_E_2); mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_SW_RESET); /* Wait for PSE client to clear TX FIFO */ - mt76_poll_msec(dev, addr, MT_CLIENT_RESET_TX_R_E_2_S, - MT_CLIENT_RESET_TX_R_E_2_S, 500); + if (!mt76_poll_msec(dev, addr, MT_CLIENT_RESET_TX_R_E_2_S, + MT_CLIENT_RESET_TX_R_E_2_S, 500)) + return -ETIMEDOUT; /* Clear PSE client TX abort state */ mt76_clear(dev, addr, MT_CLIENT_RESET_TX_R_E_1 | MT_CLIENT_RESET_TX_R_E_2); + + return 0; } static void mt7603_dma_sched_reset(struct mt7603_dev *dev) @@ -1450,7 +1454,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_FORCE_TX_EOF); - mt7603_pse_client_reset(dev); + WARN_ON(mt7603_pse_client_reset(dev) < 0); mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], true); for (i = 0; i < __MT_TXQ_MAX; i++) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h index 7c3be596da09..d651a13efe8c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h @@ -215,7 +215,7 @@ void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ba_size); void mt7603_mac_sta_poll(struct mt7603_dev *dev); -void mt7603_pse_client_reset(struct mt7603_dev *dev); +int mt7603_pse_client_reset(struct mt7603_dev *dev); int mt7603_mcu_set_channel(struct mt7603_dev *dev); int mt7603_mcu_set_eeprom(struct mt7603_dev *dev); From patchwork Tue Aug 1 04:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 709153 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 8FEBCC001DF for ; Tue, 1 Aug 2023 05:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjHAFAP (ORCPT ); Tue, 1 Aug 2023 01:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjHAFAL (ORCPT ); Tue, 1 Aug 2023 01:00:11 -0400 Received: from forward103a.mail.yandex.net (forward103a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B651FC8 for ; Mon, 31 Jul 2023 22:00:10 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:170e:0:640:d60c:0]) by forward103a.mail.yandex.net (Yandex) with ESMTP id E4CC046D1E; Tue, 1 Aug 2023 08:00:07 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 40Ji1unDfW20-4uyQ2W04; Tue, 01 Aug 2023 08:00:07 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1690866007; bh=VEn6iO0BoxDlCVA90xiICa5ns7TdRaqzC1bK670kNsg=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=mDWq1FaArXIBoauCUmK21IZlwObiFAzMGy2ao3AK3wqZFIzp7oTRCxvgwHJbmPRFZ we2d5sS6kY9lfJbh+mMsaRIfCu/3AOoqE+x3bID6CZas7IAAMLeCKpJLEX82kGazcm 62rMXy/HkUyB+aMZY4bq1s0zkFYKKhD5/spigNNY= Authentication-Results: mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Felix Fietkau Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 3/4] wifi: mt76: handle possible hardware timeout in mt76x0_phy_tssi_dc_calibrate() Date: Tue, 1 Aug 2023 07:57:22 +0300 Message-ID: <20230801050000.18864-3-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801050000.18864-1-dmantipov@yandex.ru> References: <20230801050000.18864-1-dmantipov@yandex.ru> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Check for (and hopefully recover from) possible 'mt76_poll_msec()' timeout in 'mt76x0_phy_tssi_dc_calibrate()' as it's done in 'mt76x0_phy_tssi_adc_calibrate()', convert the subject from 'void' to return 'int' and 'WARN_ON()' on it in 'mt76x0_phy_calibrate()'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index d543ef3de65b..99e4b24e258d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c @@ -500,7 +500,7 @@ mt76x0_phy_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width) mt76x02_mcu_function_select(dev, BW_SETTING, bw); } -static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) +static int mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) { struct ieee80211_channel *chan = dev->mphy.chandef.chan; u32 val; @@ -523,7 +523,11 @@ static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) /* enable TX with DAC0 input */ mt76_wr(dev, MT_BBP(TXBE, 6), BIT(31)); - mt76_poll_msec(dev, MT_BBP(CORE, 34), BIT(4), 0, 200); + if (!mt76_poll_msec(dev, MT_BBP(CORE, 34), BIT(4), 0, 200)) { + mt76_clear(dev, MT_BBP(CORE, 34), BIT(4)); + return -ETIMEDOUT; + } + dev->cal.tssi_dc = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; /* stop bypass ADDA */ @@ -537,6 +541,8 @@ static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) if (chan->band == NL80211_BAND_5GHZ) mt76x0_rf_rmw(dev, MT_RF(0, 67), 0xf, 0x4); + + return 0; } static int @@ -875,7 +881,7 @@ void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) if (mt76x0_tssi_enabled(dev)) { mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_RX); - mt76x0_phy_tssi_dc_calibrate(dev); + WARN_ON(mt76x0_phy_tssi_dc_calibrate(dev) < 0); mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX); From patchwork Tue Aug 1 04:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 709573 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 0BB58EB64DD for ; Tue, 1 Aug 2023 05:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbjHAFAQ (ORCPT ); Tue, 1 Aug 2023 01:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjHAFAM (ORCPT ); Tue, 1 Aug 2023 01:00:12 -0400 Received: from forward100a.mail.yandex.net (forward100a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27D61FC6 for ; Mon, 31 Jul 2023 22:00:11 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:170e:0:640:d60c:0]) by forward100a.mail.yandex.net (Yandex) with ESMTP id 6499746DBE; Tue, 1 Aug 2023 08:00:09 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 40Ji1unDfW20-rl1sXbYA; Tue, 01 Aug 2023 08:00:08 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1690866009; bh=KpWVlPUx1ReIXt7fZwOJI9RAgEno63qeKnSyebyodTc=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=jq99cJBssUlujQeIp1Nn53B7OuJ6WAt09GHpw5PkrN24xAlCQTMX52p4TDWqTI+PP lso/wH5tn0xOh55ZShCh5AjvCBI5A1lZ1X/eajUMGjdPkdhybnD9ukPGgtVrxDZN4p UQm14BoZH4rxr4RCdDyi2giUOZP/J24N1LcT0uxM= Authentication-Results: mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Felix Fietkau Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 4/4] wifi: mt76: adjust error handling in mt76s_txrx_worker() Date: Tue, 1 Aug 2023 07:57:23 +0300 Message-ID: <20230801050000.18864-4-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801050000.18864-1-dmantipov@yandex.ru> References: <20230801050000.18864-1-dmantipov@yandex.ru> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Adjust error handling in 'mt76s_txrx_worker()' to issue 'dev_err()' on all possible errors returned by 'mt76s_tx_run_queue()' and 'mt76s_rx_handler()', including newly introduced -ENOMEM in 'mt76s_rx_run_queue()'. This makes separate 'dev_err()' on SDIO errors somewhat redundant, so remove them. Signed-off-by: Dmitry Antipov --- .../net/wireless/mediatek/mt76/sdio_txrx.c | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/sdio_txrx.c index ddd8c0cc744d..68ab325e0dcd 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/sdio_txrx.c @@ -107,7 +107,6 @@ mt76s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid, sdio_release_host(sdio->func); if (err < 0) { - dev_err(dev->dev, "sdio read data failed:%d\n", err); put_page(page); return err; } @@ -127,8 +126,10 @@ mt76s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid, if (!dev->drv->rx_check || dev->drv->rx_check(dev, buf, len)) { e->skb = mt76s_build_rx_skb(buf, len, round_up(len + 4, 4)); - if (!e->skb) + if (!e->skb) { + err = -ENOMEM; break; + } if (q->queued + i + 1 == q->ndesc) break; @@ -143,7 +144,7 @@ mt76s_rx_run_queue(struct mt76_dev *dev, enum mt76_rxq_id qid, q->queued += i; spin_unlock_bh(&q->lock); - return i; + return err < 0 ? err : i; } static int mt76s_rx_handler(struct mt76_dev *dev) @@ -163,6 +164,8 @@ static int mt76s_rx_handler(struct mt76_dev *dev) if (ret > 0) { mt76_worker_schedule(&sdio->net_worker); nframes += ret; + } else if (ret < 0) { + return ret; } } @@ -171,6 +174,8 @@ static int mt76s_rx_handler(struct mt76_dev *dev) if (ret > 0) { mt76_worker_schedule(&sdio->net_worker); nframes += ret; + } else if (ret < 0) { + return ret; } } @@ -230,9 +235,6 @@ static int __mt76s_xmit_queue(struct mt76_dev *dev, u8 *data, int len) err = sdio_writesb(sdio->func, MCR_WTDR1, data, len); sdio_release_host(sdio->func); - if (err) - dev_err(dev->dev, "sdio write failed: %d\n", err); - return err; } @@ -324,15 +326,22 @@ void mt76s_txrx_worker(struct mt76_sdio *sdio) ret = mt76s_tx_run_queue(dev, dev->phy.q_tx[i]); if (ret > 0) nframes += ret; + else if (ret < 0) + dev_err(dev->dev, "tx error on queue %d: %d\n", + i, ret); } ret = mt76s_tx_run_queue(dev, dev->q_mcu[MT_MCUQ_WM]); if (ret > 0) nframes += ret; + else if (ret < 0) + dev_err(dev->dev, "tx error on MCU queue: %d\n", ret); /* rx */ ret = mt76s_rx_handler(dev); if (ret > 0) nframes += ret; + else if (ret < 0) + dev_err(dev->dev, "rx error: %d\n", ret); if (test_bit(MT76_MCU_RESET, &dev->phy.state) || test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) {