Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp65611pxj; Thu, 20 May 2021 04:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvM1GRGITjgEJBgIVja8Rmm6gV4yV6gg3tLpjHEDlhop4Ai4L3ZPYJBJmj74kZtlBqIeof X-Received: by 2002:aa7:d786:: with SMTP id s6mr4450785edq.239.1621510932984; Thu, 20 May 2021 04:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510932; cv=none; d=google.com; s=arc-20160816; b=sQqiETebyHGs8YmiZ4z4EhAUdVIPnvdLsYXdl4yrO7uHuMXsCcb48swP9ihwZjNedI IGAhD5rquhQHIFJ62HuIVc0TRLcVsfJggE4St1qxMul4omm6hcgTxQoYNKAPLhP2B4Lc ou3yJWeMqPsAj8ushZ4iXnSyog1oFsU+37Bnx+95Bp9Np2wVHu9PfOzFrLDAwnLskyPf dpx6S2IrkQLYtVlEQVH4QirluCAYM4NvJmU0G49YOMA1DptjmDfS5aZ+87Mj9qNRdROI CN6IdkP9xAdAwebnr9NsL8TTuHKjCqdXaWd2DeaxxavnC80oXbjYnk7ocV0nGhL49OD7 PsBA== 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=iSJW4LklXLxbdWKIrAw7fK0inCeHSd5uvha4q4m24IM=; b=yGIjwQ0zhf0caH+NzFljRbIJgvnvjaDnHGAtZo51FnemFDERkCBctwNdg01oxyQotx 1BM8j2vA4uB1bThmtEuqTxZuVZgigmu5S8kmaL0EUFU7aZRMizL7yPITz9qJPlfD/15G JQAUQAbxBexZqKm3v9x8aBUdIYXV8GaRP1ztOA/edS5lXayfqnwVXf84uGX5VIifsvy1 w9qlSi0ic67VumaXTrff6WfO45+GyEFipqmOuNdIzp25o23NYBqwqOOT104JgwAlvL5N 4M9iZZK1UlBNCfsL1GcsjTRL4VDw0T/Ulr1wJyJDITclFCBDDHceRGJLY/yKBd/hjjUF yyrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDq5Lv+b; 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 g21si2036430edv.363.2021.05.20.04.41.49; Thu, 20 May 2021 04:42:12 -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=SDq5Lv+b; 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 S242408AbhETLjj (ORCPT + 99 others); Thu, 20 May 2021 07:39:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:37990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240731AbhETLTP (ORCPT ); Thu, 20 May 2021 07:19:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CD54361D76; Thu, 20 May 2021 10:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505426; bh=iiscaPkcBcW5UAiWlZ54mhEZiIuXeONDNcb1ezIM+7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDq5Lv+b6XxShb5DodDdTqIcaaUkU5sNKlbc6tadTOdNWu03c1fw2PCh6hpFyJRm+ MBxLzRnBs/hDQx3o0HoAsWQmDEfVTFoLj/zLIqCa3yWciz1g2P/FwcqhbrT5QfuSHv XXfBA5Xc8yhTLjGUcjR4F17x6pm45hSfpeF2p3tw= 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.4 129/190] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Date: Thu, 20 May 2021 11:23:13 +0200 Message-Id: <20210520092106.464791871@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 3932e3d14f3d..379e843fbe0d 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 d50e2e8bd998..25c3e5d3fe62 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