[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200226081211.GD22801@kroah.com>
Date: Wed, 26 Feb 2020 09:12:11 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Luigi Rizzo <lrizzo@...gle.com>
Cc: linux-kernel@...r.kernel.org, mhiramat@...nel.org,
akpm@...ux-foundation.org, naveen.n.rao@...ux.ibm.com,
changbin.du@...el.com, ardb@...nel.org, rizzo@....unipi.it,
pabeni@...hat.com, toke@...hat.com, hawk@...nel.org
Subject: Re: [PATCH 1/2] quickstats, kernel sample collector
On Tue, Feb 25, 2020 at 06:30:26PM -0800, Luigi Rizzo wrote:
> +static int __init ks_init(void)
> +{
> + ks_root = debugfs_create_dir("kstats", NULL);
> + if (IS_ERR_OR_NULL(ks_root)) {
> + pr_warn("kstats: cannot create debugfs root\n");
> + return PTR_ERR(ks_root);
> + }
Do not check debugfs_create_* calls as there is no need to. Just take
the return value (if you care to use it again) and move on.
Also, the check you made here is incorrect :)
> + ks_control_dentry = debugfs_create_file("_control", 0644, ks_root,
> + NULL, &ks_file_ops);
> + if (IS_ERR_OR_NULL(ks_control_dentry)) {
> + pr_warn("kstats: cannot create kstats/_control\n");
> + debugfs_remove_recursive(ks_root);
> + return PTR_ERR(ks_control_dentry);
> + }
Same here, just call debugfs_create_file and move on.
You do this same thing in other places too.
thanks,
greg k-h
Powered by blists - more mailing lists