Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1226173lqa; Mon, 29 Apr 2024 01:55:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUySrw1JKl/9hKgU2/H3W7ps25LEYuuphvSjgETZPt9GH0dn3wEMTYS8CvPvVxR6DPyh/YmDy0pnK1yJoyMsirH/2+WZczqO3GdQeg55g== X-Google-Smtp-Source: AGHT+IHvxEb3kM+TleLbEFcReWHWngUcO4Vs7yvsM7W896R2/Fx8w/D5FhDCp3sKMp4PphC4xn/E X-Received: by 2002:a50:bb2a:0:b0:568:1248:9f49 with SMTP id y39-20020a50bb2a000000b0056812489f49mr6237648ede.18.1714380942419; Mon, 29 Apr 2024 01:55:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714380942; cv=pass; d=google.com; s=arc-20160816; b=MeafR0W1ttMEXsMB5lO2xLexoFkWagLtvs1lYZOjATxJQggkcU8uFf0UWx3/COBpP2 27ep9Nrr+tHskwRxH6QFMGOYTAo8pcIyncvss4sfaSjdHWCPU3rPAauH8kCfkdQ04axs 3BrjYHLuoFQgTtq02TcrebUQ+qoLJdv9j8/Bg+Bb65N8+Fh0pyLGsFzz0k90DCLb+sBn jqJY2IHpUK0B1dtxXDUqjjFkiX+C8SbxT1R6edXnLogtOwHFTgZyG7bXrFapiLuBUomt jGAhRc1UawT2qSzc1Voax3+Bc37OFt/dOkwbkLeQpDnOo9k3hKGydccjOx+FxGgHvg2p MF+Q== 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:message-id:date:subject:cc:to :from; bh=vBtt5AeW4Hj7GZ5PhOLNooZbbX4sxB5Er4P7xWYQJ84=; fh=301CXAO5ewvijzdZAjitIoeVZEJZg7cK3viXXqGHzac=; b=wVQ0dW/go9BJQ0bjtOAahLbTnVOOP96f9+PKQhWY6tAppSGhLp+eO5cdh9/aB10ghS bRVY7DYNKRZJYTJDvcLalY6gWaVkf7+WsbxtjjiBGCI0vY5Ky06PgtzRfn+6Pd6h0a4E sXEsd5Kl18vH+xVz4YO3KFZM86muI8hsXwU3ymCHEI8xQkLFizgvdHfTCTe0WhIVPcZ9 B1sqvR+jjuVseNf8NTpGCGV9m4ujMA+FgsJn+l8KmjQPQfdaoxcme+V7go2ZYoGnskR9 WBpkhRda4XYmndqumJDKO4D9ATsnjLMRLgumhUuu/BuHQQpFOzV+74sy8qHsdRybLivZ Bpvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-161936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161936-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a22-20020a05640213d600b005726910ecb7si3004428edx.405.2024.04.29.01.55.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 01:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-161936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161936-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2A1601F21A51 for ; Mon, 29 Apr 2024 08:55:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEBE917C72; Mon, 29 Apr 2024 08:55:34 +0000 (UTC) Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC9F817BB4; Mon, 29 Apr 2024 08:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380934; cv=none; b=q/ZNrih6LhLgG/WMiRHL8lm5earSxScPWjBwK1dQwX9r9rUPQCyQMmImAmnbBnVzyshfCNde4ESHqsrBGfZtZ6agsCFhdRUcx0T1js5b53AdGtwYDbNYNXSyLoP6+SJaQt6gog2hH8MaBAttoXdUxKc8xs8EUuiAF4veQ5REi5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380934; c=relaxed/simple; bh=rns7ha14qTiupCx4x3Wcc8y0CTICI8sh1Se/YizYD0I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CW7AqSLXNYSW+lXM8aRHPCe1+rSLgjbcdzCIvs0ocEWR82MedR6ov8cvBkMg9lmYr8oTBmvsRNgm/JHVWdN0syXdoc5CLB/UgdXdlzppIKshYm2pizndTdQY6qeTAgbFbyqO1zSe40jtgcB5cxtFIHtrdsGImUClC3sEcv2fHvQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-05 (Coremail) with SMTP id zQCowAB3fgJpYC9mH+MbBw--.23909S2; Mon, 29 Apr 2024 16:55:06 +0800 (CST) From: Chen Ni To: srinivas.pandruvada@linux.intel.com, jikos@kernel.org, bentiss@kernel.org, even.xu@intel.com, lixu.zhang@intel.com, kai.heng.feng@canonical.com, hongyan.song@intel.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Ni Subject: [PATCH] HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors Date: Mon, 29 Apr 2024 16:54:22 +0800 Message-Id: <20240429085422.2434036-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:zQCowAB3fgJpYC9mH+MbBw--.23909S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jr4xtF43GFW3GF1kKrW3ZFb_yoWDJFgEkF y0vw4xurZ7trs3trnFkry7ArW2vrW0gry8W34IqryakF97Aw47XrW8ZryrJFWfWryqyF1D XFWDZr1rAF17ujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbVkFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lc2xSY4AK67AK6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0x vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAI cVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kf nxnUUI43ZEXa7VUbqQ6JUUUUU== X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ Add check for the return value of pci_alloc_irq_vectors() and return the error if it fails in order to catch the error. Fixes: 74fbc7d371d9 ("HID: intel-ish-hid: add MSI interrupt support") Signed-off-by: Chen Ni --- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index e79d72f7db2a..9b9bc58f0524 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -174,6 +174,11 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* request and enable interrupt */ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); + if (ret < 0) { + dev_err(dev, "ISH: Failed to allocate IRQ vectors\n"); + return ret; + } + if (!pdev->msi_enabled && !pdev->msix_enabled) irq_flag = IRQF_SHARED; -- 2.25.1