Re: [PATCH 2/7] crypto: ccrree: no need to check return value of debugfs_create functions

From: Greg Kroah-Hartman
Date: Wed Jan 23 2019 - 08:37:39 EST


On Wed, Jan 23, 2019 at 02:58:22PM +0200, Gilad Ben-Yossef wrote:
> Hi,
>
> On Tue, Jan 22, 2019 at 5:14 PM Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > 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.
>
>
>
> I get the part about not failing loading the driver just because some
> debugs entry isn't available, but wont it be weird if
> debugfs_create_dir() fails but debugfs_create_regset32() succeeds and
> we suddenly have weird files in the debugfs root dir?
> Not the end of the world of course but maybe it's better to avoid
> trying to create the files if the directory is not available?

See this patch to handle that theoretical issue:

https://lore.kernel.org/lkml/20190123130917.GZ4087@xxxxxxxxxxxxxx/T/#me91cc3d16185be13d64f85c8477c543cbda9baf6

thanks,

greg k-h