Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12970637rwl; Wed, 4 Jan 2023 01:22:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoeygpgxKhWNGbtku0a1/kuIE/Y+w4JGR6mWoTJfkYlFKhZkuJqCMrw3DLUy2jh5HMxrGm X-Received: by 2002:a17:90b:e84:b0:226:5c65:547b with SMTP id fv4-20020a17090b0e8400b002265c65547bmr14009716pjb.30.1672824171451; Wed, 04 Jan 2023 01:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672824171; cv=none; d=google.com; s=arc-20160816; b=dxQjVrasl6MAPcIwmf2BGoj3TGz41Ucv7LW2vkJshzV86VOmR0x6rlWoBaxdM3dr8S cw6a7riRsJi1syLWmW4MhJAVBXKHeOJF8vhbBYt0ntVDUtmHUWaC+CHutPHP89/ngwVY 12SDKhqr1RnKNkhsglrCTTlxkQsAtnUT17x+7h5tKveIQvD5GCkahYjQ6WM+FLPjk/lk sEYEaVp10LspGIk+yL9Y4u7rCzWmhFWZKEH17MGtxS4kie8NSLxlCMactaiMpU4xR3Qx TRRCAdzx/HOTGQObzlkt6GWC/uGNqgKxAP2SxJcgJHpNh9MnKCH+6O3mv70Hs3dfWAPc BxpQ== 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 :message-id:date:subject:cc:to:from; bh=HIKZzutxD7dZC+1jLbHV7xlSx7So2N2NuX1oT3LCi98=; b=Z4qZusfteTJnBs1t+yDFjCVhAiN1z6KYaFmmnuInH57sERlSZcmK7VJAUUT4vY4wK0 YQlJEH89EqhVfrwu29n/NqoEEAR71xZpJ8LmWk+SsJ9PPQRUHVwq5DQpW0TVbTIG4dz8 +XzDG/arZ3WjoGhDVXsMiwYuaVzUwc+6hKTdvDpMdlTbSzUmCg2wS9deCyaxxIqKWjq8 uD7z55QfQVq6VpC5xbzQ5U4eXOzCV9RR1noglqrZwCIY3qG7R0+0uwjzHrFNq9URXi+j CZGX/MyC8fh7tLGYuheVwUxcTTkECNxJSk8CHGe7Qj2qmJ1wjZfRZAAfgDNeoMJobGi0 LO/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na12-20020a17090b4c0c00b00218ac70fdefsi10817090pjb.183.2023.01.04.01.22.44; Wed, 04 Jan 2023 01:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234112AbjADJQ3 (ORCPT + 57 others); Wed, 4 Jan 2023 04:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234306AbjADJQX (ORCPT ); Wed, 4 Jan 2023 04:16:23 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6ACE711C27; Wed, 4 Jan 2023 01:16:20 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowABHT5fSQ7VjbrFsCg--.39697S2; Wed, 04 Jan 2023 17:16:05 +0800 (CST) From: Jiasheng Jiang To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, lpieralisi@kernel.org, kw@linux.com, mani@kernel.org, kishon@kernel.org, bhelgaas@google.com Cc: ntb@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] PCI: endpoint: pci-epf-ntb: Add missing check for alloc_workqueue Date: Wed, 4 Jan 2023 17:16:01 +0800 Message-Id: <20230104091601.22719-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowABHT5fSQ7VjbrFsCg--.39697S2 X-Coremail-Antispam: 1UD129KBjvdXoW7XrWrWw1rZrWxWrW8Wr4fuFg_yoWfuFb_Wa y7ZrsrWrZ8Kr1kury5Kw4xZFyIk3s0qFnxXF4rtF9IkFy8CrZY9w4DXryDAr18ur15Kr1q 934jvr98Jw17KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbx8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUkrc fUUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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-kernel@vger.kernel.org Add check for the return value of alloc_workqueue since it may return NULL pointer. Fixes: 8b821cf76150 ("PCI: endpoint: Add EP function driver to provide NTB functionality") Signed-off-by: Jiasheng Jiang --- drivers/pci/endpoint/functions/pci-epf-ntb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-ntb.c b/drivers/pci/endpoint/functions/pci-epf-ntb.c index 9a00448c7e61..304956bc0516 100644 --- a/drivers/pci/endpoint/functions/pci-epf-ntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-ntb.c @@ -2124,6 +2124,9 @@ static int __init epf_ntb_init(void) kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); + if (!kpcintb_workqueue) + return -ENOMEM; + ret = pci_epf_register_driver(&epf_ntb_driver); if (ret) { destroy_workqueue(kpcintb_workqueue); -- 2.25.1