Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5571240rwb; Tue, 22 Nov 2022 01:42:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf61NYK22SoSPOAZQ8p59wHIBWMK1IO9VAvw9Cn3tjdC3apzZzisnZSHgg45TMk0GRBf8fye X-Received: by 2002:a05:6402:110d:b0:469:dd6:bfee with SMTP id u13-20020a056402110d00b004690dd6bfeemr3422786edv.330.1669110174275; Tue, 22 Nov 2022 01:42:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669110174; cv=none; d=google.com; s=arc-20160816; b=t9fIpD7BO0xIJGEHy8Wcszv0yeHgSJfyWHsgjan/EZMJhJmYRAgdc/AWxekmPqd4oM MFwxoqz5mZjJxG0p4E53KUfirIzUlGpWC7MhTufsTn2yDxug/33DcJI0LDoiuFQccLRh Tn4hGpCLySkvjjA+rFPfgsgcKdBQek2C7Hn+2aDs8VU3l8nCDszdU+i93Ad3XtCSx6nP tehoCUHJvaY29zCG8a8u1fA4zWk+wFCULANrAocvwzkot1FDe2QaoH8ipMF9JAqKFStU jmktxKcvULB8CFfARKLok9WKMU+3w2yIHC0eHx94+sCL7xvnaEaAInKq61/IHH5HlmZS OHVg== 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=azoEtd7ZEnmDT4tAtdLOxw0PFkLgCmRDcrbvNiwi6T0=; b=CjBRpvVSKbtmBGe2p0nebtC0+VMN6fNkiYIxSk11dT1m1wzwB5cJ9s+8qLSoMLtMwB I4WjTrRvdIb0cgOdPXrZytCD2yThj7niJOa/Ag4PsrbBu1WCRruYcc+ZxLay7xQuaimy Jj4e+xmLsVNsAoZu10NJsbCAGPM/0WCjruyHWiBvSPCdvjUXbeRMA4BRB8rinVBZiaG3 ERN0mptOZcKJO+d3hmtenUCHPIin0VCDWcy6h4C8dskQbBNjlVYCeSKeh1eWiwbH1Jq8 nsMnNdtSL3+/mZxd8kx7Jy6S3ylw3GeUkDA9N3MS/n4fBIQsDOCk867EaXXUMWMcM8g6 gpRg== 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 qa35-20020a17090786a300b007adadff675fsi12546407ejc.313.2022.11.22.01.42.31; Tue, 22 Nov 2022 01:42:54 -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 S232836AbiKVJTi (ORCPT + 91 others); Tue, 22 Nov 2022 04:19:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiKVJTP (ORCPT ); Tue, 22 Nov 2022 04:19:15 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66B1949B60 for ; Tue, 22 Nov 2022 01:19:07 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowAAHDpYBlHxjrWbEAA--.49387S2; Tue, 22 Nov 2022 17:18:58 +0800 (CST) From: Jiasheng Jiang To: maximlevitsky@gmail.com, oakad@yahoo.com, ulf.hansson@linaro.org, christophe.jaillet@wanadoo.fr, axboe@kernel.dk, hare@suse.de Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] memstick/ms_block: Add check for alloc_ordered_workqueue Date: Tue, 22 Nov 2022 17:18:56 +0800 Message-Id: <20221122091856.47606-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowAAHDpYBlHxjrWbEAA--.49387S2 X-Coremail-Antispam: 1UD129KBjvdXoWrtw1UZFykAryxWr4kXFyxXwb_yoWfurXEkr yxZF48tFW0k3W8AryUAryruF9ayw40gryFqayrtwsxJrW7CF15Zr1jv345ur18uFWUCry3 Ca4DX34rZw1UKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUq38nUUUUU= 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 As the alloc_ordered_workqueue may return NULL pointer, it should be better to add check for the return value. Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Jiasheng Jiang --- drivers/memstick/core/ms_block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index ba8414519515..ccfdb3dea30a 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -2116,6 +2116,9 @@ static int msb_init_disk(struct memstick_dev *card) dbg("Set total disk size to %lu sectors", capacity); msb->io_queue = alloc_ordered_workqueue("ms_block", WQ_MEM_RECLAIM); + if (!msb->io_queue) + goto out_cleanup_disk; + INIT_WORK(&msb->io_work, msb_io_work); sg_init_table(msb->prealloc_sg, MS_BLOCK_MAX_SEGS+1); -- 2.25.1