Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp802990rwb; Mon, 26 Sep 2022 06:08:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rhbFCsUqXFIUny2YKVIoUlTH131dqLBAfQsenjdMvtNyYlIEWCL1yG533V4EPEXr7r/UT X-Received: by 2002:a17:903:1211:b0:178:a692:b1e3 with SMTP id l17-20020a170903121100b00178a692b1e3mr22858643plh.48.1664197735166; Mon, 26 Sep 2022 06:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664197735; cv=none; d=google.com; s=arc-20160816; b=L/IapxHhTw8se/WVOBH7u53YRP4sMoUTbl0fiX3+OySE1M92PCXVLWeyGL/evppD03 s0e+/ehN93vG3uuvfAbdHmdu1fxmQLpTGuVQs2PTJ+x0mWZ04HeLXnAbme9bcs9ADmGR 3QZdmkdcdr03alekhkyicf9y/LlrCmXasKWoTU7XE2gWC3f4MBH6edvWxqDyD4mz3bAA 0e1yodRNGM+ol15JfBb8zTz42NbgsywWva5uIavrUSWSKf9k3LKcN2NtsByGJCiqgvBA jD4dhIUvwYt+kc8qVhFoS+yABn1JgZzTJm2JJcNeCCCdyws4jHDCn/zYMvaFt00W8MPF VQvg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jPQkUC/XMv8kfkoUn1hXk3VQZguNOti9Q5sgo9QL2LI=; b=HMaDr6aYsy39zUNRLazvm7+7iJTVqZvlRC4G0aOCsaZnKVsZYlpcl7Ce/6+7CcZ0NY fVDYyo1/uEK1921muxYDhRJunmIalaF7dbF/jGDe6XqNbr+Z5sVjDXjZfGGS/ZwTT46L S8LnLjhaKE24lp9G5hs3WiO8VobQRFt/HKY59pCM69WO0EIyVtOSSo72YTq/Ucb8o58c xFht9IV1V5udrulJpqqsV5h2QbC/il0y4wFYaIo+duIzctzn2ypdrSh1oVYc1uDCyeUT JeCxNDKoWJNmib719H9qkKnyatBK8JsxfMJUvw/iZGEE/MVY7718BS2C7BgozcpR2D9H mjpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CQdPAcyw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f132-20020a636a8a000000b0043c05e17c63si15356145pgc.90.2022.09.26.06.08.40; Mon, 26 Sep 2022 06:08:55 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CQdPAcyw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235497AbiIZK1W (ORCPT + 99 others); Mon, 26 Sep 2022 06:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235665AbiIZKYe (ORCPT ); Mon, 26 Sep 2022 06:24:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B59C4DB46; Mon, 26 Sep 2022 03:18:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 748D7B80936; Mon, 26 Sep 2022 10:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B943AC4314B; Mon, 26 Sep 2022 10:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187476; bh=aPkn8qEGPPOgAxRGlG5ronfsQ/tTwSJPOGcRU1zvwQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQdPAcywrsGTfWUAMNjGjchsHWhdlBssYxMCKsHIgSMu4vb87kiAj0sdG5RMDVONz MD34U5NlxB+DG3lNXKnGTiJv8RFZmUsSOE1D4r0byRKKLe4jMwZjwCUj+8O1lSWfmL WelIuI0/m4mHYFSlvlbdAkfO9pPPlc7Kyl6r6IN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" , Maxime Chevallier , Nick Desaulniers , Nathan Huckleberry , netdev@vger.kernel.org, Sasha Levin Subject: [PATCH 4.19 08/58] mvpp2: no need to check return value of debugfs_create functions Date: Mon, 26 Sep 2022 12:11:27 +0200 Message-Id: <20220926100741.719639256@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100741.430882406@linuxfoundation.org> References: <20220926100741.430882406@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org From: Greg Kroah-Hartman [ Upstream commit e6882aa623f6fe0d80fa82ebf3ee78c353bffbe1 ] When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: "David S. Miller" Cc: Maxime Chevallier Cc: Nick Desaulniers Cc: Nathan Huckleberry Cc: netdev@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: David S. Miller Stable-dep-of: fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") Signed-off-by: Sasha Levin --- .../ethernet/marvell/mvpp2/mvpp2_debugfs.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c index f9744a61e5dd..87d9cbe10cec 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c @@ -484,8 +484,6 @@ static int mvpp2_dbgfs_flow_port_init(struct dentry *parent, struct dentry *port_dir; port_dir = debugfs_create_dir(port->dev->name, parent); - if (IS_ERR(port_dir)) - return PTR_ERR(port_dir); /* This will be freed by 'hash_opts' release op */ port_entry = kmalloc(sizeof(*port_entry), GFP_KERNEL); @@ -515,8 +513,6 @@ static int mvpp2_dbgfs_flow_entry_init(struct dentry *parent, sprintf(flow_entry_name, "%02d", flow); flow_entry_dir = debugfs_create_dir(flow_entry_name, parent); - if (!flow_entry_dir) - return -ENOMEM; /* This will be freed by 'type' release op */ entry = kmalloc(sizeof(*entry), GFP_KERNEL); @@ -554,8 +550,6 @@ static int mvpp2_dbgfs_flow_init(struct dentry *parent, struct mvpp2 *priv) int i, ret; flow_dir = debugfs_create_dir("flows", parent); - if (!flow_dir) - return -ENOMEM; for (i = 0; i < MVPP2_N_FLOWS; i++) { ret = mvpp2_dbgfs_flow_entry_init(flow_dir, priv, i); @@ -579,8 +573,6 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent, sprintf(prs_entry_name, "%03d", tid); prs_entry_dir = debugfs_create_dir(prs_entry_name, parent); - if (!prs_entry_dir) - return -ENOMEM; /* The 'valid' entry's ops will free that */ entry = kmalloc(sizeof(*entry), GFP_KERNEL); @@ -618,8 +610,6 @@ static int mvpp2_dbgfs_prs_init(struct dentry *parent, struct mvpp2 *priv) int i, ret; prs_dir = debugfs_create_dir("parser", parent); - if (!prs_dir) - return -ENOMEM; for (i = 0; i < MVPP2_PRS_TCAM_SRAM_SIZE; i++) { ret = mvpp2_dbgfs_prs_entry_init(prs_dir, priv, i); @@ -636,8 +626,6 @@ static int mvpp2_dbgfs_port_init(struct dentry *parent, struct dentry *port_dir; port_dir = debugfs_create_dir(port->dev->name, parent); - if (IS_ERR(port_dir)) - return PTR_ERR(port_dir); debugfs_create_file("parser_entries", 0444, port_dir, port, &mvpp2_dbgfs_port_parser_fops); @@ -671,15 +659,10 @@ void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) int ret, i; mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); - if (!mvpp2_root) { + if (!mvpp2_root) mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); - if (IS_ERR(mvpp2_root)) - return; - } mvpp2_dir = debugfs_create_dir(name, mvpp2_root); - if (IS_ERR(mvpp2_dir)) - return; priv->dbgfs_dir = mvpp2_dir; -- 2.35.1