Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp85503rwd; Wed, 31 May 2023 19:30:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7StA8SgkVIH0D0CXXcvcVQp5uiEuQfl8Ivo8WxWSGbZ7bjM0rDW/DalP+7f9fUyygDgt0l X-Received: by 2002:a17:90a:6b0f:b0:256:2efc:270e with SMTP id v15-20020a17090a6b0f00b002562efc270emr7994298pjj.5.1685586631040; Wed, 31 May 2023 19:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685586631; cv=none; d=google.com; s=arc-20160816; b=Yi38vdx6D0EXWGJFUpDaAKBVx4u0zgx2KSMYb6bI3ZSWEucWQVIGHoq1YHgMAd5xRO DAjDWfpb1dnt2j2dx+eYHaQLS+i5jSl1nCSM3wda+ZBglCPUDmqJkQFt79X/klYOQUJu 2m8xDSGUeIiIA5K5SA3Pu5245JUlQ8itjDjeUryoDE16UjN7dI/FLoyKN0Bq5cqc9pCC PNKas0YLR2KPiinpjiO50UhWAVpTu2iJFOIGnC13andFZwb2jzE0BVEhRto94RO6u6XU xze2bYaB1ewMpHpIAE3GMJqK8nsioAj0eB00iQKNb+I8SAynoQoKsQMah9CoPwrf88GL RD0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=rSoXdTlMKfGR+FOKX8kq+k3BGQpNpTpshl5CEMy3Kdc=; b=d5FwSC5Odcfcb9R/xW64AbYYsG5ZI2jFRs7nlnGhPwiBqW+X5QOH9Q11qnwnzcrY72 Di0dWsWCZ22gPpTJpM+ejosDiwosWewFELlW4HwF1YDS6XIcAZaovSPQ/nKGuTEogOEZ T8tN8c1gfLDYGe09XqbLWDslH9Otafqt16UzN3pr0UD/dOPpx8Q9PaQOgN9FcGSDPTNf vrxgUZHeHzJp1mlSWGnk9miq+Na4mVV6uE6ET6eERvePI3KKmq0fCdSDc04aUtV1cTJI 8QINHGpMfyNw/brkkgiHueXvpqOw1QH1greBahJ6nPMnWb8ME7x+SkCw5o9xa/op4pHc 3Q/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=SyRnPrSf; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090a4e8300b0023def94be5esi359379pjh.20.2023.05.31.19.30.16; Wed, 31 May 2023 19:30:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=SyRnPrSf; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbjFACY1 (ORCPT + 65 others); Wed, 31 May 2023 22:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229874AbjFACY0 (ORCPT ); Wed, 31 May 2023 22:24:26 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82448B3 for ; Wed, 31 May 2023 19:24:25 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-392116ae103so102663b6e.0 for ; Wed, 31 May 2023 19:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685586264; x=1688178264; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=rSoXdTlMKfGR+FOKX8kq+k3BGQpNpTpshl5CEMy3Kdc=; b=SyRnPrSf896jnKvY/OWcihCwRxxJ89qew6SIs4T02KO4/t+8U68mw1aB6Otaj60kzl Fj1Fny2v9y1+f0vonIfmAsFwlGHW1MUQPouoi/c08DD6IxRDznye+rzDcWeRnbHwCxCg OIXCVrd3IOvykAaAhH3OuVvphhgoWNkLMMPPC1B/YeBeKfNC2THO1oMww67vJEjrkMqv Q0R9v97HoXtYdUYG7MwRVhPQBf7RnZoC6JRcgF/9U4b/+5dNFi4etfwej08RDRpNm4qU 5T4ZLj22ZXVQrhomKbPrqF5Now5Y6iTalVO8rmIDN6J/8wRGBCEEArNP1ffdURia+M3I r7JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685586264; x=1688178264; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rSoXdTlMKfGR+FOKX8kq+k3BGQpNpTpshl5CEMy3Kdc=; b=Xhv87NsDYwA1gvt/s0QoOccJKsBTeUADaRNWsavPZid1MCeFVy748HHnqS2/vLfalW egJa/SoTSIy3gQW5qDHWVsU2LFcJiRIZQUYTFK3VUHeyiKy/HUyieF3a++H2ScZK6ZeD 1HhJhNRxdI4zXTHz8vmOTiFy7+lT9GNDdfCSyGtaSMcyHyS0bLkfn9eai6loi+UTz8ZS hCPhwsH/1SJUgeEsehS3fXe3V6Bz96T8sSfFFf5frhmP8UXtmCf64m5rFWykj5bXK2YK 8ZaRzcfE/w2+H4v/VIShiPZbIWPc1DgVg6nklGJkq6+Sjuvimd7Svw1y4ZmKpd8QVrkT YDjQ== X-Gm-Message-State: AC+VfDymQYpFyJtkQaqvVZWXH8Xj0ZtcWnWfcOlTabiYMMujVl2PdBZp yV75gxI3rvx9QCB8k6+RzXtIYIwx2JbWPAveO0sj4meiI/k= X-Received: by 2002:a05:6808:1898:b0:398:29ed:f609 with SMTP id bi24-20020a056808189800b0039829edf609mr4998518oib.1.1685586264446; Wed, 31 May 2023 19:24:24 -0700 (PDT) MIME-Version: 1.0 From: Neal Sidhwaney Date: Wed, 31 May 2023 22:23:48 -0400 Message-ID: Subject: [PATCH] wifi: brcmfmac: Detect corner error case earlier with log To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list.pdl@broadcom.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In some corner cases, an I/O read can fail and return -1, and this patch detects this slightly earlier than is done today and logs an appropriate message. Signed-off-by: Neal Sidhwaney --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c index 9f9bf08a70bb..9b38c6f2f37f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c @@ -972,6 +972,7 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci) u32 regdata; u32 socitype; int ret; + u32 READ_FAILED = 0xFFFFFFFF; /* Get CC core rev * Chipid is assume to be at offset 0 from SI_ENUM_BASE @@ -980,6 +981,11 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci) */ regdata = ci->ops->read32(ci->ctx, CORE_CC_REG(ci->pub.enum_base, chipid)); + if (regdata == READ_FAILED) { + brcmf_err("MMIO read failed: 0x%08x\n", regdata); + return -ENODEV; + } + ci->pub.chip = regdata & CID_ID_MASK; ci->pub.chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; -- 2.40.1