From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D02B2C433E0 for ; Wed, 10 Mar 2021 06:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E27264FC8 for ; Wed, 10 Mar 2021 06:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231483AbhCJGuu (ORCPT ); Wed, 10 Mar 2021 01:50:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:39758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbhCJGuT (ORCPT ); Wed, 10 Mar 2021 01:50:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 99BBB64FE3; Wed, 10 Mar 2021 06:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615359008; bh=0iq7+MXnAugaS8tGYJcIZQ46Nvi0Y80pR9IOpJAY8B4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RLk4J/aj3YTlilDpi5gBT0HSib+K7M3fgCi4BXIHM4S6/iRn/aX/i73Db1Hg6HTJL ZC2RgX6frI0ipwzI38k5tU2uhLxYK2Ph5v39v8U9PT7dZq1LOMqXraDjyp7Q4K9Ikh eGm7ryIiMw3rxCPf1RFROQg8JAaRkGFgAeXKyHak= Date: Wed, 10 Mar 2021 07:50:04 +0100 From: Greg Kroah-Hartman To: Chris Down Cc: linux-kernel@vger.kernel.org, Petr Mladek , Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , Steven Rostedt , Kees Cook , kernel-team@fb.com Subject: Re: [PATCH v5] printk: Userspace format enumeration support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 02:30:31AM +0000, Chris Down wrote: > + ps->file = debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index, > + ps, &dfs_index_fops); > + > + if (IS_ERR(ps->file)) { > + pi_sec_remove(mod); > + return; > + } No need to check this and try to clean up if there is a problem, just save the pointer off and call debugfs_remove() when you want to clean up. Or better yet, no need to save anything, you can always look it up when you want to remove it, that will save you one pointer per module. thanks, greg k-h