Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3126634rwb; Tue, 8 Nov 2022 00:30:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4unkylVbyAtSvCiEbKlh6KF4r9p45t/TEoLADZrPk76JYzPys1nOo/AxLxqjMkvT9D7aZX X-Received: by 2002:a17:906:9fc1:b0:761:9192:504f with SMTP id hj1-20020a1709069fc100b007619192504fmr4946635ejc.116.1667896246992; Tue, 08 Nov 2022 00:30:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667896246; cv=none; d=google.com; s=arc-20160816; b=bPYXRf0yoccyWFZF4U5cZNo+Or3yzsg41a9tbEf/4U90SvOMZ1gl3v/Rx5qWIidIqF BwP1LHuG5taAUbDCJNA0AznVnWu8uPow1/jIFP43MuD1HG4ZKDJz6vxdP312OBwn4O0n BCURjeuzpVf0XK76hJTsnnParu6eGvUVUafHzanqGtg8Gyf8k56h5HDr9Gv7GS5VjJ8T Jd4K7YUTg/X7uH/x3f6Lfv8qMmsdG0AfKxBEzI6sfNw1M59UJMLrPUqVS+7uXmtbNVy1 5UUParciTehkBO2LB60/ZPHDzwivyCcBP5pE62OfpZbIxTNExNM2jrfQwVXNqVIkloOA lXmg== 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=2VkdVi7N6MnG8JDq3Qvawl6C1w04FNo+ty9iEk0yFs0=; b=RIU3UozDCB48ryg7MeJbfTJzvnr2JBIZXi4AKF5g8rDf6YfI36pgfSXV9WRwYsjIEP buybNFrW31JTy1ztQ44SR4dRaxgStxKzoMgSvqIj0u+SCioaDJbi/5dGL3d+SUDhxBFw bfnoyvHvqhStndWp5WT1bqI4aeFA+IuJw+Vb4pPRYVryUArPxddTbtHeaoz5/zsy1zwX +64FFR814xSB5cvOkunoLfAhMbi7OKYLxw0MF6qQYo4Ncgzgf0rJWs01z/Y6awVritt9 3Ep7sdynL0pxRbH43Y8ReyKxYfxXhw1ieJ6vLbf3p9mAdes0upggWb/q7cfMns0sL+xy KWoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 v8-20020a170906b00800b0078356aaeb61si8135779ejy.286.2022.11.08.00.30.11; Tue, 08 Nov 2022 00:30:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 S233410AbiKHI3X (ORCPT + 99 others); Tue, 8 Nov 2022 03:29:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233529AbiKHI3R (ORCPT ); Tue, 8 Nov 2022 03:29:17 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F729BC85 for ; Tue, 8 Nov 2022 00:29:15 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N61Tn6TSgzmVj8; Tue, 8 Nov 2022 16:29:01 +0800 (CST) Received: from cgs.huawei.com (10.244.148.83) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 16:29:13 +0800 From: Gaosheng Cui To: , , , CC: Subject: [PATCH] crypto: ccree - Remove debugfs when platform_driver_register failed Date: Tue, 8 Nov 2022 16:29:12 +0800 Message-ID: <20221108082912.1818219-1-cuigaosheng1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.244.148.83] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500012.china.huawei.com (7.221.188.12) 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 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-crypto@vger.kernel.org When platform_driver_register failed, we need to remove debugfs, which will caused a resource leak, fix it. Failed logs as follows: [ 32.606488] debugfs: Directory 'ccree' with parent '/' already present! Fixes: 4c3f97276e15 ("crypto: ccree - introduce CryptoCell driver") Signed-off-by: Gaosheng Cui --- drivers/crypto/ccree/cc_driver.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index cadead18b59e..d489c6f80892 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -651,9 +651,17 @@ static struct platform_driver ccree_driver = { static int __init ccree_init(void) { + int rc; + cc_debugfs_global_init(); - return platform_driver_register(&ccree_driver); + rc = platform_driver_register(&ccree_driver); + if (rc) { + cc_debugfs_global_fini(); + return rc; + } + + return 0; } module_init(ccree_init); -- 2.25.1