Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2119041lkv; Thu, 20 May 2021 03:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynuG0jqO5skeIY7eP87Upu/OhlcG2/N3cZt/W2Ma3blxfTDzWrddkMfDAL3xJe64tQO9Au X-Received: by 2002:a17:906:82d5:: with SMTP id a21mr4122968ejy.5.1621507918191; Thu, 20 May 2021 03:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507918; cv=none; d=google.com; s=arc-20160816; b=qTjzqvYLw2hSlgCRvEVCzf4IYnhI7aPL3IgJTvmCx14Gt5Esq80Gx/vDfu2qG8H6Gt pW8dzO4qJrWCBHqyAvP1muYWQJblhWoc3hO29D17TLzBabyeZ0do9aCLflqtnbCiNimf xeNDWYTSME1IlQiNmR3oC0WAHsbtIE+OO48TPvb6GZKN6zDUr0JrEfhGcz/O4g9aY79d UlmBGmOdeRIxNcs4teht+Ohk7RhU+C2OWWdLWqpke6yQKDIjZ/OuOL8l01VdVcI70F2G D/kmheHwp9ZTw3OFTEoVTlTlJTlvIqgzBsm3Punuyo+nV9sO3DoCSdwqBif6V8QQqMnc P8Rw== 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=WgHjf7GCScxQO/kk/WLi4cyvi9ctgbqmiLrRoyQYZpo=; b=uOUDKt085vUdHRgRQFHd/530hA2Kg5SqyUu2+tllc97MTyG3lWzcMfkF6FNHmR23T0 lkb3qqUTZ4a8EkUGjb5kFPRECfs2vPp5SxK1UBfgukKZOgx4l34qKKolAS5V6VEWYcR9 B1sp+b0xE8iTy5CWo5xObJav/qnOwWSuMVFVGLl4ebiLRG/GXb4QJxuy7/MgxBVrYFZ4 oFcymzUtDdI6NhirDHALOSWygEj7cMXjIaHhKS6TY5iF8tsv4nr6uCAzyn+PRqDuVPPG MSFk/VOGCeQTpDvL/kDvXzOteJ4Gj1n29B4Xx+gytT1Uv4q4doo3/ga8MbWGu5FCzZSe MM/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RGAxf8Hu; 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 ci19si2287467ejb.380.2021.05.20.03.50.48; Thu, 20 May 2021 03:51:58 -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=RGAxf8Hu; 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 S238697AbhETKuK (ORCPT + 99 others); Thu, 20 May 2021 06:50:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237249AbhETKdp (ORCPT ); Thu, 20 May 2021 06:33:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 091FA61C54; Thu, 20 May 2021 09:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504389; bh=dQVMyqFmdJZLV5KZ+KgQETcpsT3j27enl1PaykF2Az0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RGAxf8HuDEeOT70lI8KefYqd6i36UJ8YsbPBF+AiucX+NzhQDayV3poexHgBy38l/ x7jMosq5gcfETNITSoRGzysztarKUHlUlMHJKQSXMxL1zee+WBHKHPpgfY+R0YvqOh BXMO8GTX9odggxgsWpsuP5CBejMvgW51jDjyGBf8= 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 4.14 223/323] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Date: Thu, 20 May 2021 11:21:55 +0200 Message-Id: <20210520092127.785891440@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 66ef5cf16450..88e3b4a4de31 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 406b52f114f0..933d4f49d6b0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -285,7 +285,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