Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4634335pxj; Wed, 12 May 2021 09:42:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKncGjh3lhrc0WdNgPA2JoHvgxoz4/KBKtgd3G1dnXMk1RWWbIAqJ/6sNWNhEvD4ckoxiy X-Received: by 2002:aca:2818:: with SMTP id 24mr25999205oix.67.1620837738840; Wed, 12 May 2021 09:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837738; cv=none; d=google.com; s=arc-20160816; b=zfbuDaAR89696m1WtSnOmBsYdfQW5kWxnCX16YaAPo3SWzTRHTzScQS594fhApY634 QfIISFaaX257Ta6hXNiDclCetgmCzICSygGiMYIasqpYAay/bwqOVTUEF0lqHpqjW40c 0Mv0W80+JGbR8WfWBnVIYQwthjbzROZF6/TJF7ePAscdbQnGmhK0qooISfrhwVrKaTW1 HQPCzm46fIYnZZwrwgOCSx1EX5VKT1nhhl4+/OXp9gb34wuSuowRR6W3KjyDPjMuA8bQ 0sxw+ZUDlu52eLaZ6f1lFdhJQk+rvajui2mVJHe+7iVSAY2TuGmSnvUX20RkVH2nLJIp ICiQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qh08tqR91IDLJ7rN6QQfQBhaxCm6v0Doz4dQyDvkUmU=; b=cfOg8oR6gTmI9VMWQ7PpX7SHZahqE0SgY/GrU8eDtybKBmWKRkYEw2WJF0hWyXNAU1 PIiRjiyzCfAesnvEeICv88kNNS7wrPBxdHu3kSfbGnotLvhrc74ed9rCOQl8+tRTN8Qs BexAhoc1oKPSOBiZgUyxlmNE8xWngzPLpVXB4a8GoMdo9cixlwBzYT9qSu808zTfrTcv TrdWroA8PY95VBlnHHg8aspsiHRMa0no+42wDu5VieIP6EtmEMjZrgduvPEjsaMgKcA5 S4UVVBvh0JEzgclx22M+u/7dnj30jK/4rV0Pp+ND4pXAVT2PsU5TWATztWLjeZoWE1uh MMFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xC/HYM4C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m3si255448ote.193.2021.05.12.09.41.55; Wed, 12 May 2021 09:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b="xC/HYM4C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241271AbhELQjd (ORCPT + 99 others); Wed, 12 May 2021 12:39:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:41352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236860AbhELPq7 (ORCPT ); Wed, 12 May 2021 11:46:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F690619AE; Wed, 12 May 2021 15:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620833028; bh=qs3BSpGTH4/KHU8TgZEjQF6q6b3oyPpsVJ9KkAETij4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xC/HYM4CCFFxHUDlHJ1SwX/Etn+ZxfVvbpaJIJvJajNNJIJduQrO7nEBJmGFGwVju 6WdbPhqnPp0tcghxRo5t6L45YPY2zDIGAljjX3Jgxac0Iz9Mhfu1OtvHRFUSZhqML1 fvKDxK5UB9LSJ+PXtfgOfqglzQeamt+BYelP/MA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Lorenzo Bianconi , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 486/530] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Date: Wed, 12 May 2021 16:49:56 +0200 Message-Id: <20210512144835.731808497@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke Høiland-Jørgensen [ Upstream commit 7dd9a40fd6e0d0f1fd8e1931c007e080801dfdce ] When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output. Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO. Fixes: 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register") Signed-off-by: Toke Høiland-Jørgensen Reviewed-by: Lorenzo Bianconi Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210326180819.142480-1-toke@redhat.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index db0c6fa9c9dc..ff61ae34ecdf 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -246,7 +246,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset) if (unlikely(r)) { ath_dbg(common, WMI, "REGISTER READ FAILED: (0x%04x, %d)\n", reg_offset, r); - return -EIO; + return -1; } return be32_to_cpu(val); diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6609ce122e6e..c86faebbc459 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -287,7 +287,7 @@ static bool ath9k_hw_read_revisions(struct ath_hw *ah) srev = REG_READ(ah, AR_SREV); - if (srev == -EIO) { + if (srev == -1) { ath_err(ath9k_hw_common(ah), "Failed to read SREV register"); return false; -- 2.30.2