Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2064823rwb; Sun, 14 Aug 2022 20:27:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR7T+TwEn84vOr01lR3TuoOwMCKXOo4N2ZqRLSsgB8L3l3800nw+FoKFX6Mec7d1zwyKC/8r X-Received: by 2002:a63:d609:0:b0:41d:9296:11d4 with SMTP id q9-20020a63d609000000b0041d929611d4mr12156395pgg.102.1660534027545; Sun, 14 Aug 2022 20:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660534027; cv=none; d=google.com; s=arc-20160816; b=bpxSZ/Ys3UwARDadwjnbkdUuxkWWWwBE4WJU7OglxZxHG65pb87v7vRu769OXUXHoR 6okq6vwmgbwHcXhcpi0jYujhpIpu9JADWHpBThKXwROcGLDq8J12UMD06s/MMcRlpmVF Oq0Be21B/4kjCEUbgyvLivf/u+BN9Sa6gStaaS1+rZ1kBHBcXKycBVY+SULPLGWU88x9 MkZrt/0eriDu9TA8NgegR7zPJobj1ks98N4GfdfwMCz7VqxbW9WdVL1Th3Ve4Jw+BBR/ PBf75WYQH5ERFIOFtMoZFeIdp6t/CB3J06M0Rhk3VVzeXXr9FDyly2wAuzpmUg5i/s37 BGNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=zUAV+6tPz5EBser3cWt0cRqpU8DUjjKIBYFEXzR2SDM=; b=NGgWAW4wB6RhGC8Znb8XocUMu/g03CyVT5sG0tL4Uu98UtVuR7gB7tjKYOP8WZD38g yBQsVyRPap6za9PawkBymGZHTU+lzapkICN9LMwsVDaxiyrXO8M3Mp5N6BryzD8HjdSg F8fOky82+SQYlx14eIHLCO2S9+r5axJ+MdUY7VOe7ZakzUzzI3w7mygGepWtWVztZcXo DdjQXW3rYGavRJFD0OEaeLUEZtj2fUJxXVctAQxQJpEjyYyat0ZlXykj5Utmgb858i2X gx7NiCztpIitiDTsEQwmNy6aoGdzpM1QBFJw/MdcegyUKzUhQwl1VBCBPmLGkHdwi8G6 1M8Q== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a170902b48a00b0016da21c9176si8863089plr.469.2022.08.14.20.26.29; Sun, 14 Aug 2022 20:27:07 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiHODRK (ORCPT + 99 others); Sun, 14 Aug 2022 23:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiHODRH (ORCPT ); Sun, 14 Aug 2022 23:17:07 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D341112A98 for ; Sun, 14 Aug 2022 20:17:05 -0700 (PDT) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4M5fYK5t3QzGpVy; Mon, 15 Aug 2022 11:15:33 +0800 (CST) Received: from huawei.com (10.175.112.208) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:17:03 +0800 From: Yuan Can To: , , , CC: , Subject: [PATCH -next] iommu: Remove duplicate ida_free in iommu_group_alloc Date: Mon, 15 Aug 2022 03:14:23 +0000 Message-ID: <20220815031423.94548-1-yuancan@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 the iommu_group_alloc, when the kobject_init_and_add failed, the group->kobj is associate with iommu_group_ktype, thus its release function iommu_group_release will be called by the following kobject_put. The iommu_group_release calls ida_free with the group->id, so we do not need to do it before kobject_put. Signed-off-by: Yuan Can --- drivers/iommu/iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 780fb7071577..74bc9111c7be 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -654,7 +654,6 @@ struct iommu_group *iommu_group_alloc(void) ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype, NULL, "%d", group->id); if (ret) { - ida_free(&iommu_group_ida, group->id); kobject_put(&group->kobj); return ERR_PTR(ret); } -- 2.17.1