Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1717413rdb; Thu, 25 Jan 2024 04:16:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJGL3chK69hCoN1WKriXMHJMNKsF5yfOEGxlqECCJRIULQXq5jGLXYqSKbE1giiVwKfV6k X-Received: by 2002:a17:902:aa05:b0:1d5:dfd3:1eb6 with SMTP id be5-20020a170902aa0500b001d5dfd31eb6mr554685plb.118.1706184986492; Thu, 25 Jan 2024 04:16:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706184986; cv=pass; d=google.com; s=arc-20160816; b=KanDWSA6Eb8MRqQGjHxqKHkdk1J5RsDRNjJe1lGwKD9PBEs3LL5so3e6d7lBGz6KMO duArgk18AUKNTqDXMEwDFIBMjlycPA0dmaR/2ItOkq/+Vmdx9BbwL9y/FFSk9R/k0Rq/ 1JnkvjhfAtPY6FXXg7n6bHnZANeWiLjF6FNJIpS0UF++ZgLhSKN5xlOvOGodERF5V0qw 7IGpJJzmevl7jQj/rrnm9UxUYuNyZlOpTTSDWlbaz7EVIA8X2AELAF25Y/QMnvrtZOrs 4mzQ0xQ7DxL+ZqEJcCIa1ES6ST3pf6LoVth8pfbS/tebMQwD+l5rlFaPSRiNpkwBERz7 fCZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DhAGgHSQg3iaRjZyPsuDKQG2aidSJSftuw6sxVV6ZuA=; fh=wr2Yobploz6z8zoxei6KFtJI/w5xhHoMiZUIzl1RYzg=; b=zQMrwpJ/3jupnJ2JsDvQUNsXcO8/dGkU/wXjly5n3Ky0PdlS5dZYo9WiOAcNXbrCf+ ZDA7aTFNfrfYkpqugGY1R8oPRTn1MhtQVAUjZTrZG/PgHR5xF946nyD3G1wbJhC9B4KR eI4XtH7vhLHWjpnvnMhOiaaXENgValUoZemBvaWEUH3EcKVvNpclAvbeGSBN8IsbFOw+ yvYYCy9GijKgBGHgHoqic82pS3EcubBGEfSgfCUEWcmYEnssWdAToJc7ZEb6vQ7PbTx1 TEpbMBBh4mlkeGzvTb3t/KInCzyT3wfK9laYaqPVYOEqngSlHepi64E3PwBHJMnIFD5T 1VNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=by8Bq9r+; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-2474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a5-20020a170902ee8500b001d74823fc26si7465107pld.583.2024.01.25.04.16.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:16:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=by8Bq9r+; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-2474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E991428F3BA for ; Thu, 25 Jan 2024 12:16:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0BD24502D; Thu, 25 Jan 2024 12:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="by8Bq9r+" X-Original-To: linux-wireless@vger.kernel.org Received: from forward205c.mail.yandex.net (forward205c.mail.yandex.net [178.154.239.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AA764502F for ; Thu, 25 Jan 2024 12:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.216 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706184980; cv=none; b=J6HRp2kUYDFc24uV4NiEINbjd/7y6K+7rVz/jB6BkKZIc+Z9m1zDWFGIG9fwtiokQ8NPFbefHk5t3ghye+Z2ycfEi9wNpho5EHRzdJPoqXXHOqFF94iLtwoho3/clzaeK1vFfWTea4cc/csIxKq3dKy81LdH/ITXLSnyOHVx/6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706184980; c=relaxed/simple; bh=jWNcpm0HjnW055yLJwBcXPpXJcJ2Zto1bGFTojAsGqs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=inVdczs5ywcJITN6hR8RAEqIGdhPiqJ+7B9kmixNLVIRzfipM7i25lUmfiqoZh+iYk1+jECHsrm5stCViytQzpXpu7JZCQAuZrPorbrc8nRuGDhOHqzRIVk4c+nakEbeeiqXSdaJFr7p45Ys5SXU7qPDUAld1kDh7JDMuM6FZHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=by8Bq9r+; arc=none smtp.client-ip=178.154.239.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Received: from forward101c.mail.yandex.net (forward101c.mail.yandex.net [IPv6:2a02:6b8:c03:500:1:45:d181:d101]) by forward205c.mail.yandex.net (Yandex) with ESMTPS id 8455665727 for ; Thu, 25 Jan 2024 15:08:33 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:2a0c:0:640:2804:0]) by forward101c.mail.yandex.net (Yandex) with ESMTPS id 729FE608F3; Thu, 25 Jan 2024 15:08:25 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id M8TQNP9f9Os0-W4GaREYl; Thu, 25 Jan 2024 15:08:24 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1706184504; bh=DhAGgHSQg3iaRjZyPsuDKQG2aidSJSftuw6sxVV6ZuA=; h=In-Reply-To:Cc:References:To:Message-ID:Date:Subject:From; b=by8Bq9r+KibpppFx51VmMKGYlZBPP0ZYY1Ezs94zQpNGTALZ9/vSjmwFaZ70qNUJI McSQXXdTwWs96shztPAJuWDSJrjsS1ycFcPcPi3Pj4AINsz0OMAvHu84BbC4lNxhNV qRDEamJKcrXeTvwbF9QP17Tdcjey6GtyNz7Qrkwg= Authentication-Results: mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Arend Van Spriel Cc: Bjorn Helgaas , Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 2/2] [v4] wifi: brcmfmac: handle possible PCI irq handling errors Date: Thu, 25 Jan 2024 15:07:29 +0300 Message-ID: <20240125120740.111330-3-dmantipov@yandex.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240125120740.111330-1-dmantipov@yandex.ru> References: <20240124133331.GA351271@bhelgaas> <20240125120740.111330-1-dmantipov@yandex.ru> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Switch to newer 'pci_{alloc,free}_irq_vectors()' API and handle possible errors in 'brcmf_pcie_request_irq()'. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Suggested-by: Bjorn Helgaas Signed-off-by: Dmitry Antipov --- v4: prefer devm_{devm_request_threaded_irq,free_irq}()', use 'pci_irq_vector()' and fix title (Arend, Bjorn) v3: switch to 'pci_{alloc,free}_irq_vectors()' per Bjorn's review v2: rebase against wireless-next tree --- .../broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 80220685f5e4..17b855164025 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -965,6 +965,7 @@ static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg) static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo) { + int ret; struct pci_dev *pdev = devinfo->pdev; struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); @@ -972,11 +973,16 @@ static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo) brcmf_dbg(PCIE, "Enter\n"); - pci_enable_msi(pdev); - if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr, - brcmf_pcie_isr_thread, IRQF_SHARED, - "brcmf_pcie_intr", devinfo)) { - pci_disable_msi(pdev); + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); + if (ret < 0) + return ret; + + if (devm_request_threaded_irq(&pdev->dev, + pci_irq_vector(pdev, 0), + brcmf_pcie_quick_check_isr, + brcmf_pcie_isr_thread, IRQF_SHARED, + "brcmf_pcie_intr", devinfo)) { + pci_free_irq_vectors(pdev); brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq); return -EIO; } @@ -996,8 +1002,8 @@ static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo) return; brcmf_pcie_intr_disable(devinfo); - free_irq(pdev->irq, devinfo); - pci_disable_msi(pdev); + devm_free_irq(&pdev->dev, pdev->irq, devinfo); + pci_free_irq_vectors(pdev); msleep(50); count = 0; -- 2.43.0