Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp349668pxj; Thu, 20 May 2021 10:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF28/lxUA1aEa0zoraN1QdB0oXCuwdKeRw41HPhLZGwM1IZR3DiOTloWRN7BQ49tzCYDPT X-Received: by 2002:a02:6d09:: with SMTP id m9mr7560578jac.131.1621532580595; Thu, 20 May 2021 10:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532580; cv=none; d=google.com; s=arc-20160816; b=pGQd4qgwRgNDrlO1ailAUmG/5SMpwR2w7uUtyAIi48i00puLm9eCnuF0b3DPiLMM3u 27VyNv6RqzE4oVPLl/Y+Vpc8fZnv94pv2N1d99z4Ex69LLxeUCtcuiHpZ3/y5mho4V12 P3zUCzAtiDQvdTpN4ZMoxrVmow326npaj5zTJQqV3s1+9Ka2/IjnqZWE3edNdD/TwCHg pZsFctmrm68hnPzakuBRtOqy5Sf8yNlaxb2z261NYzEcqdj/vgwkrQ2Mvlxx0bIM/SI5 HmvVfA3ZN1jD+VbA0NKcnUp24dKE/0vXfUGDVW2qTjh3O2OSEMiw7zvS0g03hR19ybOg ynVQ== 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=dP+8EcJ/hRf2qIvVawjhmrKnCl595pdxe+AdRL1BQio=; b=tJg//hX4Gbn4lzQDRaNkafWUVjfO0RMPjQwZUN3XQYUp3UFcrW539wNfYTymstxavx EwRI00RHCefFa0xOiWbausC2SYordpql1kbo+tz2l18UyYBUficEXQo3kT1AjjMAgCBA FUPC1rdBlELCiM2PYFDrK90vWlRVTRFGmA1o4Yc9VGlOIJzh7RWQc2sYa0XbiCA5c0Dk ryaAegocpT2E6tn0hxs+GDqoXoPU++A0sDmiX/gSi7ogLq0NYxFFhJrVoijDYGAAudgg NkRd+OZ3SvrGrqZVgMYKOVb6vcSuzwprJNokyNL15Do/hYTAgffP38bfH3G80bcW7+XC CmMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VEvWAn04; 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 t10si3451019ilf.139.2021.05.20.10.42.47; Thu, 20 May 2021 10:43:00 -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=VEvWAn04; 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 S235379AbhETKLW (ORCPT + 99 others); Thu, 20 May 2021 06:11:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:37246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235046AbhETKBx (ORCPT ); Thu, 20 May 2021 06:01:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4DAC613C7; Thu, 20 May 2021 09:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503575; bh=3hkc2ps3l3rA61gkvCZxOktPrH8DBjtxE4/mQt4na/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEvWAn04TV0etd97VzAA66YajXu4EyAO49sJz2JJ2v4qSdCOxHS9nX6dl4+i2amzB F6e58jCet2/A8gXcioEVr+sn0jPZE2Gy7JwiSwmMu6vWvehBuSCmre/VdeiF2S9A84 2iFTuWSNw5/MEBMBhz2AZOdllBZsDbSTT1aopt8Y= 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.19 282/425] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Date: Thu, 20 May 2021 11:20:51 +0200 Message-Id: <20210520092140.712918602@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 27d9fe6799f5..cb136d9d4621 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 b4f7ee423d40..9f438d8e59f2 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