Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp547533pxj; Thu, 20 May 2021 15:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYaXptc5ZKTSqAXdX1+kqTC6l1cWoIp5KePrSp/BW6rT0E4HJxQMoHh+X7ZTiaYYd7KsFM X-Received: by 2002:a05:6402:50d2:: with SMTP id h18mr7660340edb.10.1621551356896; Thu, 20 May 2021 15:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621551356; cv=none; d=google.com; s=arc-20160816; b=z4dcwsdoeT61N6D498k61PuIDTEXall+z5Wv2GnsOEc23XINlrbCrm9nOe0aljA+Q8 09za8rEiqyrPKCE1eft+tH3P1ZLEDNO07ySxtrNjwh50+JepL6TzC1njURHp3eeevBfe RLUd69KNUOWqMvYfwiwzJZRvMUvfuCy3/P0C57+sbNMjSb+yhjMtLOS/FrUwsE+NtlzM G3VYFlX6DLu0rRZ6B33ZxqxHXy+Tp2PeUWTdcOxFYlSxmZPIlF6oOnpCmeUFKybulv9H WbMdfwrp+AcN1mhvOWHs/qoy3xiHH+jZoXOCPbgiBsadef21XC+8ZmL1ti5q12aIe4M2 9q2Q== 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=5DpQWPj9u2d83U/63majmMkO7ty3GBmCwcezKmdrW+w=; b=vOyZ+XAVK4NpUZn4UEXHtatAeFSOzv0Hcmr/7P3UaFlnSFFMsWjM5xqNFeTxufzHzX SeDeO3ooWulWIzW0bEekHnvzp0Is31ap2+b1Dli+bvDogdPY4sDzI/mEpFG4Kukep/xr 9Nk/xKuoqtI1n+FlWrdC851HlPguM14/ERgRLM11xIO/nWXY7jPzXdznrmaP/frHLlGP hw4ftO4DVzmzCcJpu1bKPjRqxZ6Sg54MAFhJ+ehDXf/fx7EmahZdW2jaNyrxRXCqwrKJ k44/tHliZRwjmzNNTzu/iQ8BPwH57k2N81a31X4Gi8a1uhk6dqTz29Bv7ETDrsqtOHgQ D1pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YWpEvaq3; 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 b1si3513697eju.282.2021.05.20.15.55.33; Thu, 20 May 2021 15:55:56 -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=YWpEvaq3; 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 S240656AbhETLTG (ORCPT + 99 others); Thu, 20 May 2021 07:19:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:57504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239319AbhETK6w (ORCPT ); Thu, 20 May 2021 06:58:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6894613C9; Thu, 20 May 2021 10:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504963; bh=LwyKKuJhez3Ec+1Kjgypop6eGz0miF8Pt3i3GUl3z0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWpEvaq3uIKj/Dz7HCM5SWsKMgrPzRCuEqJFHZq77A+oXf1p7pYQuUReb0SHWbgmN QzV7tBTwmA9ONmQNIM6u1xCHMvEhf3/35IrLtWXFT5d9MYphYv3VRq4Ryc4iuX+xYx 08AIIEJRkXXlQy1YOEophk5vZ6Saa2LvhMvCR3ow= 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.9 161/240] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Date: Thu, 20 May 2021 11:22:33 +0200 Message-Id: <20210520092114.054774132@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 15a0036dcc6e..09d737f3461b 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 e7fca78cdd96..9d664398a41b 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