Re: [PATCH 2/2] mm: memblock - Handled failure of debug fs entries creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, Apr 27, 2012 at 4:51 AM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
On Thu, 26 Apr 2012 01:29:52 +0530
Sasikantha babu <sasikanth.v19@xxxxxxxxx> wrote:

> 1) Removed already created debug fs entries on failure
>
> 2) Fixed coding style 80 char per line
>
> Signed-off-by: Sasikantha babu <sasikanth.v19@xxxxxxxxx>
> ---
>  mm/memblock.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index a44eab3..5553723 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -966,11 +966,19 @@ static int __init memblock_init_debugfs(void)
>  {
>       struct dentry *root = debugfs_create_dir("memblock", NULL);
>       if (!root)
> -             return -ENXIO;
> -     debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
> -     debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
> +             return -ENOMEM;

hm, why the switch to -ENOMEM?

    Just for consistency (But its dumb mistake I made).
 
Fact is, debugfs_create_dir() and debugfs_create_file() are stupid
interfaces which don't provide the caller (and hence the user) with any
information about why they failed.  Perhaps memblock_init_debugfs()
should return -EWESUCK.
   
   I'm working on a patch which address this issue. debugfs_create_XXX  calls
   will return proper error codes, and fixing the existing code not each and every part  but the code
   which handles the values returned by debufs_create_XXX otherwise it will break the existing
   functionality . (any suggestions or opinions ?)
   .

Thanks
Sasi

> +     if (!debugfs_create_file("memory", S_IRUGO, root, &memblock.memory,
> +                             &memblock_debug_fops))
> +             goto fail;
> +     if (!debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved,
> +                             &memblock_debug_fops))
> +             goto fail;
>
>       return 0;
> +fail:
> +     debugfs_remove_recursive(root);
> +     return -ENOMEM;
>  }
>  __initcall(memblock_init_debugfs);



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]