Re: [PATCH kunit 1/3] kunit: add debugfs /sys/kernel/debug/kunit/<suite>/results display

From: Greg KH
Date: Thu Jan 23 2020 - 09:55:34 EST


On Thu, Jan 23, 2020 at 02:47:18PM +0000, Alan Maguire wrote:
> +int debugfs_init(void)
> +{
> + if (!debugfs_rootdir)
> + debugfs_rootdir = debugfs_create_dir(KUNIT_DEBUGFS_ROOT, NULL);
> + if (IS_ERR(debugfs_rootdir))
> + return PTR_ERR(debugfs_rootdir);
> + return 0;

No, you never care if a debugfs call works or not, just call it and move
on. So just create the directory, and then pass it into whatever
debugfs call you want, never test it or do anything about it. This
function can be void as well.

> +void debugfs_create_suite(struct kunit_suite *suite)
> +{
> + /* First add /sys/kernel/debug/kunit/<testsuite> */
> + suite->debugfs = debugfs_create_dir(suite->name, debugfs_rootdir);
> + if (IS_ERR(suite->debugfs))
> + return;

Same here, don't test, just call and move on.

thanks,

greg k-h