Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6770366rwb; Wed, 10 Aug 2022 00:19:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/bFogQYjup4IShLWqUM+uEgRI3gWHCL0Fot3dQS50BMOLzYK17owyKneOIpSARf+KgEPE X-Received: by 2002:a17:903:31c9:b0:16c:3024:69c4 with SMTP id v9-20020a17090331c900b0016c302469c4mr26718221ple.81.1660115997592; Wed, 10 Aug 2022 00:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660115997; cv=none; d=google.com; s=arc-20160816; b=E0tYyUxf3wUEl43u5G3ChLah3RZZo8qoFcCo4lE+HCIkFQBfNbkrVpTwnW8Fq4OROQ Pq0DEDjgykwxCWUKIE0K2jdPdh8mVcmKoJeE6KGura2ywMwguGDhsDlYWkZUwEuNTZg+ m/v9WJu/qndrW08CcouFn7ALY93uhIeYDwG1evfmVHVTMTQ1sJZ+6S6DtKo6ILyOvi6o 5CfyzFU2/I0Bq4IUJwdAKvTAOuD3hBtP5luugQF43GszWbvdZjY4y2OB1GP5lIx3HLS+ oToZMa/3i54O2Yx+mRILFoPt3fByd2GI7cuV0iU0IbAcs7xk9Bft93QNb/ZjMJ0D7Ru6 QNwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:mime-version:message-id :date:subject:cc:to:from; bh=lgUcDrEy84Me/x2O2ysmTzoXGCoUZDHpKUtq8ZdGMvk=; b=xfHTM1Kxuju/PuszNfZcSqe2MAjE1FA4z0rETAF9lzwKdr4jUP/yEBY5QC5IHvEU5l OXRFf4el+LlylshLOSQXLx5Kld4znAyR/5qigM+UaZIA+5TVod2G8Xz8RySaMh6lDSdE N8I/5ENdWO1+Kiz+/kbgs2wJm5oE0JFYp9xzR7WZ0vVj0wwHrZgZsQql6+H1ha2QJkg/ X4d275R4H9GUZFtttNKxy98UsdVsakrMkeWjRGgmoD0ge9xFyKtlHz4yN+Vmg/45OEQv MDKtRmn1OqbCVFZy1x4LADZd08z+BH2uwpdq/uxy9BdN0mshC8F2BTU3M3VX/4x0BaeF qfKA== 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 iz3-20020a170902ef8300b0016c09d28af1si14654043plb.621.2022.08.10.00.19.44; Wed, 10 Aug 2022 00:19:57 -0700 (PDT) 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 S230283AbiHJGHw (ORCPT + 99 others); Wed, 10 Aug 2022 02:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbiHJGHu (ORCPT ); Wed, 10 Aug 2022 02:07:50 -0400 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5568561DAE for ; Tue, 9 Aug 2022 23:07:47 -0700 (PDT) Received: from ([60.208.111.195]) by unicom145.biz-email.net ((D)) with ASMTP (SSL) id EER00042; Wed, 10 Aug 2022 14:07:42 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201603.home.langchao.com (10.100.2.3) with Microsoft SMTP Server id 15.1.2507.9; Wed, 10 Aug 2022 14:07:41 +0800 From: Bo Liu To: , , , CC: , , Bo Liu Subject: [PATCH] nvdimm: Call ida_simple_remove() when failed Date: Wed, 10 Aug 2022 02:07:37 -0400 Message-ID: <20220810060737.5087-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.200.104.97] tUid: 20228101407423e730e450a495fa8ac99b446cb56c639 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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-kernel@vger.kernel.org In function nvdimm_bus_register(), when code execution fails, we should call ida_simple_remove() to free ida. Signed-off-by: Bo Liu --- drivers/nvdimm/bus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index b38d0355b0ac..3415dc62632b 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -371,6 +371,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, return nvdimm_bus; err: put_device(&nvdimm_bus->dev); + ida_simple_remove(&nd_ida, nvdimm_bus->id); return NULL; } EXPORT_SYMBOL_GPL(nvdimm_bus_register); -- 2.27.0