Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1144296pxb; Thu, 4 Mar 2021 04:37:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAZSs+XC9GvFPu7jT3rVWqH1UZCe9PowjIFYmU4+UtMy/BO+Vuzn8T322FcSvQX1aIR4nK X-Received: by 2002:a50:ec81:: with SMTP id e1mr4030336edr.0.1614861477791; Thu, 04 Mar 2021 04:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614861477; cv=none; d=google.com; s=arc-20160816; b=l8eYxkg2eAD1Z/zJSR2XFdOHx6PMYFGiNTZ2W1dXSKYo0XexKgcqeHcPHR4huiOMqJ NxUFZpAwBBswXo1tmErnvVezfHTRmCWs2stTd5OSzxda+KjSX7n+6VLz58/1eESu/3cL UIaSMYOT2rq8drvlnSgUiayD5IJrj1eK45yJ9iEzb5Dt3T6seeXuEEeo3dMQHKOuf0OH QrtwRXiKOM84K4RxLNRW04hQboYU/44zsc90DnLH/QXvjqdeQxXvS3zsZ2IbSuCqujmJ hT74Tys7EghMBC6RVbWpKmtZJr70E6/pxcQnl/qoiRtP98QxUu86yjLT6ElXwLEztVij SVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2fWUgjysv3Uj5ZOpZuhRBjwCP3u5uDsrquEEvuruiwc=; b=JMb6+yH07orNXixymgtqtN5wWUMDURMcVo39i96iGpt9BDOO3u5/iPBDFuEma8JXDC jiu2r2Ki4iLJfKjA5FNytCJ3aQ9r9VIczDcHDVMHK7+OWgLBeUH2EtuxIfMBXCl1WX2T M89YQ7d8Iz8x9c7q8GON3BDtH8s/KU30wWbaM+qIyrMKUGtM4dLhHpeb6oC5Bcux00oG bZlou24fquq5/PCTURS6roTJ4H5wMVKfyD4SCXTO3NpMEH8Z0g4a14V3KffsfUWu6Yc9 pBc4H+tVHOBVw+9yYCrAjG4QLkFbqX1Lw9u5kukD88VCSg5+HWX4CT0CpTXgrwF8ha/7 izVg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qq23si8314803ejb.505.2021.03.04.04.37.35; Thu, 04 Mar 2021 04:37: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235052AbhCCVQr (ORCPT + 99 others); Wed, 3 Mar 2021 16:16:47 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:44190 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1356498AbhCCKrj (ORCPT ); Wed, 3 Mar 2021 05:47:39 -0500 X-UUID: 4c81aa0874e4496b99d54a60b8144632-20210303 X-UUID: 4c81aa0874e4496b99d54a60b8144632-20210303 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 561527874; Wed, 03 Mar 2021 18:38:06 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 3 Mar 2021 18:38:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 3 Mar 2021 18:38:04 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 3/4] mt76: mt7915: check mcu returned values in mt7915_ops Date: Wed, 3 Mar 2021 18:38:01 +0800 Message-ID: <76a1830344d468e229e2b16badaabe707c8756b3.1614753100.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Properly check returned values from mcu utility routines in mt7915_ops. Signed-off-by: Ryder Lee --- .../net/wireless/mediatek/mt76/mt7915/main.c | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index bb49ea9307e0..255f87aa1830 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -25,6 +25,7 @@ static int mt7915_start(struct ieee80211_hw *hw) struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw); bool running; + int ret; flush_work(&dev->init_work); @@ -33,21 +34,44 @@ static int mt7915_start(struct ieee80211_hw *hw) running = mt7915_dev_running(dev); if (!running) { - mt7915_mcu_set_pm(dev, 0, 0); - mt7915_mcu_set_mac(dev, 0, true, true); - mt7915_mcu_set_scs(dev, 0, true); + ret = mt7915_mcu_set_pm(dev, 0, 0); + if (ret) + goto out; + + ret = mt7915_mcu_set_mac(dev, 0, true, true); + if (ret) + goto out; + + ret = mt7915_mcu_set_scs(dev, 0, true); + if (ret) + goto out; + mt7915_mac_enable_nf(dev, 0); } if (phy != &dev->phy) { - mt7915_mcu_set_pm(dev, 1, 0); - mt7915_mcu_set_mac(dev, 1, true, true); - mt7915_mcu_set_scs(dev, 1, true); + ret = mt7915_mcu_set_pm(dev, 1, 0); + if (ret) + goto out; + + ret = mt7915_mcu_set_mac(dev, 1, true, true); + if (ret) + goto out; + + ret = mt7915_mcu_set_scs(dev, 1, true); + if (ret) + goto out; + mt7915_mac_enable_nf(dev, 1); } - mt7915_mcu_set_sku_en(phy, true); - mt7915_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH)); + ret = mt7915_mcu_set_sku_en(phy, true); + if (ret) + goto out; + + ret = mt7915_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH)); + if (ret) + goto out; set_bit(MT76_STATE_RUNNING, &phy->mt76->state); @@ -58,9 +82,10 @@ static int mt7915_start(struct ieee80211_hw *hw) if (!running) mt7915_mac_reset_counters(phy); +out: mutex_unlock(&dev->mt76.mutex); - return 0; + return ret; } static void mt7915_stop(struct ieee80211_hw *hw) @@ -631,12 +656,13 @@ static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val) { struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw); + int ret; mutex_lock(&dev->mt76.mutex); - mt7915_mcu_set_rts_thresh(phy, val); + ret = mt7915_mcu_set_rts_thresh(phy, val); mutex_unlock(&dev->mt76.mutex); - return 0; + return ret; } static int @@ -663,22 +689,22 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_RX_START: mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, params->buf_size); - mt7915_mcu_add_rx_ba(dev, params, true); + ret = mt7915_mcu_add_rx_ba(dev, params, true); break; case IEEE80211_AMPDU_RX_STOP: mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); - mt7915_mcu_add_rx_ba(dev, params, false); + ret = mt7915_mcu_add_rx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_OPERATIONAL: mtxq->aggr = true; mtxq->send_bar = false; - mt7915_mcu_add_tx_ba(dev, params, true); + ret = mt7915_mcu_add_tx_ba(dev, params, true); break; case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: mtxq->aggr = false; clear_bit(tid, &msta->ampdu_state); - mt7915_mcu_add_tx_ba(dev, params, false); + ret = mt7915_mcu_add_tx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_START: set_bit(tid, &msta->ampdu_state); @@ -687,7 +713,7 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_TX_STOP_CONT: mtxq->aggr = false; clear_bit(tid, &msta->ampdu_state); - mt7915_mcu_add_tx_ba(dev, params, false); + ret = mt7915_mcu_add_tx_ba(dev, params, false); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; } -- 2.18.0