Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3414060ybl; Sun, 2 Feb 2020 23:18:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwyya+2vuJCrSf/YY5hRnWhqjHDuB7LSqNveJlAYOqFhvTL7YjbC6LAY+R4K6aUtmFxancD X-Received: by 2002:a9d:65da:: with SMTP id z26mr16814738oth.197.1580714328599; Sun, 02 Feb 2020 23:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580714328; cv=none; d=google.com; s=arc-20160816; b=HFWpFiuCgjoxuOHEmEyOPFGwPeKOSJLQVdc790pZMen2hCBSHwhfH41+8Tj+91s5eF ojzSMGR23L4WrSeQ9VI+TyV4NnGgrxRZtKCKrK5CoaFEODM5GEUw0LWPjB8DqFuf8ed5 gzxa/zJyF1zn1F4+cFXS5MU/l9FuelwNyg2L3aQeEKxoLiMQHisqgNOXgPcd6Kd3W9Eq 1QA1iJV32sEIZZrNs0YIlHZy9T12v9ZrkfJjnXHZYMk4ud2u4tIC04hD7EKATvzDf7LK 6C0CakhV3AMVyuo4MKNAFPTivIXyq6EGmlZg4jt+taaPaWitLU+j2Ay28juU3C58bgsU RXkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:authenticated-by; bh=i52BGYlKj1dagx9q7gVoAZZW1H+Pbg7CLpz00xHI2Wg=; b=cOO1iR35VQsR9T3MObHg/FBVzFZFoU/Ti6rAYyJqRRYtnMwaLoLsFehuEyVOGiF3zb i7ZscPBNNdmYSBoiiJEnmMqZoHM7sUUlE5AzGp5mnj2ZQimQ2BnxmlBLdO/CA4pHYdYh g1vRGOcbS8OpzwmguHPakyYTHpXRCmojCN/FeJPIPngFrQ3aSV8XHBhA5x3QG7CTXxWr Rj6DBJ0CjLuVIfZc7nDg846sU4ePGCO6GFBifl2SjsCZyv4QGDyfiLV3+sZGHWQKPRtu D7tVd0Mm8JnW+maK4UO7W+xIHb2mp4TsxrA/F0q7kCDlxRlZbTfKOygZBMMfkRrobZ9F 1ZsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si8728675otq.31.2020.02.02.23.18.37; Sun, 02 Feb 2020 23:18:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbgBCGCQ (ORCPT + 99 others); Mon, 3 Feb 2020 01:02:16 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:53592 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbgBCGCQ (ORCPT ); Mon, 3 Feb 2020 01:02:16 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID 0136256M007987, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTEXMB06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id 0136256M007987 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 3 Feb 2020 14:02:05 +0800 Received: from RTEXMB05.realtek.com.tw (172.21.6.98) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 3 Feb 2020 14:02:05 +0800 Received: from RTEXMB06.realtek.com.tw (172.21.6.99) by RTEXMB05.realtek.com.tw (172.21.6.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 3 Feb 2020 14:02:05 +0800 Received: from RTITCASV01.realtek.com.tw (172.21.6.18) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.1.1779.2 via Frontend Transport; Mon, 3 Feb 2020 14:02:05 +0800 Received: from localhost.localdomain (172.21.69.117) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Mon, 3 Feb 2020 14:02:04 +0800 From: To: CC: , , Subject: [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status Date: Mon, 3 Feb 2020 14:01:57 +0800 Message-ID: <20200203060157.15330-1-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.69.117] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Chin-Yen Lee Clang warns that ret is used uninitialzed. And we found that actually the return type should be "int" instead of "bool". Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c") Link: https://github.com/ClangBuiltLinux/linux/issues/850 Reported-by: Nathan Chancellor Signed-off-by: Chin-Yen Lee Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/wow.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/wow.c b/drivers/net/wireless/realtek/rtw88/wow.c index af5c27e1bb07..4820dca958dd 100644 --- a/drivers/net/wireless/realtek/rtw88/wow.c +++ b/drivers/net/wireless/realtek/rtw88/wow.c @@ -281,27 +281,26 @@ static void rtw_wow_rx_dma_start(struct rtw_dev *rtwdev) rtw_write32_clr(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE); } -static bool rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable) +static int rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable) { - bool ret; - /* wait 100ms for wow firmware to finish work */ msleep(100); if (wow_enable) { - if (!rtw_read8(rtwdev, REG_WOWLAN_WAKE_REASON)) - ret = 0; + if (rtw_read8(rtwdev, REG_WOWLAN_WAKE_REASON)) + goto wow_fail; } else { - if (rtw_read32_mask(rtwdev, REG_FE1IMR, BIT_FS_RXDONE) == 0 && - rtw_read32_mask(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE) == 0) - ret = 0; + if (rtw_read32_mask(rtwdev, REG_FE1IMR, BIT_FS_RXDONE) || + rtw_read32_mask(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE)) + goto wow_fail; } - if (ret) - rtw_err(rtwdev, "failed to check wow status %s\n", - wow_enable ? "enabled" : "disabled"); + return 0; - return ret; +wow_fail: + rtw_err(rtwdev, "failed to check wow status %s\n", + wow_enable ? "enabled" : "disabled"); + return -EBUSY; } static void rtw_wow_fw_security_type_iter(struct ieee80211_hw *hw, -- 2.17.1