Re: [PATCH] backing-dev: no need to check return value of debugfs_create functions

From: Greg Kroah-Hartman
Date: Wed Jan 23 2019 - 01:46:54 EST


On Tue, Jan 22, 2019 at 05:25:03PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Jan 22, 2019 at 05:07:59PM +0100, Sebastian Andrzej Siewior wrote:
> > On 2019-01-22 16:21:07 [+0100], Greg Kroah-Hartman wrote:
> > > diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> > > index 8a8bb8796c6c..85ef344a9c67 100644
> > > --- a/mm/backing-dev.c
> > > +++ b/mm/backing-dev.c
> > > @@ -102,39 +102,25 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
> > > }
> > > DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats);
> > >
> > > -static int bdi_debug_register(struct backing_dev_info *bdi, const char *name)
> > > +static void bdi_debug_register(struct backing_dev_info *bdi, const char *name)
> > > {
> > > - if (!bdi_debug_root)
> > > - return -ENOMEM;
> > > -
> > > bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
> >
> > If this fails then ->debug_dir is NULL
>
> Wonderful, who cares :)

Ok, after sleeping on it, I'll change this function to return an error
if we are out of memory, that way you will not be creating any files in
any other location if you use the return value like this. That should
solve this issue.

thanks,

greg k-h