lkml.org 
[lkml]   [2015]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] UBI: fix return error code
From
Date
Am 20.11.2015 um 11:14 schrieb Sudip Mukherjee:
> We are checking dfs_rootdir for error value or NULL. But in the
> conditional ternary operator we returned -ENODEV if dfs_rootdir contains
> an error value and returned PTR_ERR(dfs_rootdir) if dfs_rootdir is NULL.
> So in the case of dfs_rootdir being NULL we actually assigned 0 to err
> and returned it to the caller implying a success.
> Lets return -ENODEV when dfs_rootdir is NULL else return
> PTR_ERR(dfs_rootdir).
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/mtd/ubi/debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
> index b077e43..c4cb15a 100644
> --- a/drivers/mtd/ubi/debug.c
> +++ b/drivers/mtd/ubi/debug.c
> @@ -236,7 +236,7 @@ int ubi_debugfs_init(void)
>
> dfs_rootdir = debugfs_create_dir("ubi", NULL);
> if (IS_ERR_OR_NULL(dfs_rootdir)) {
> - int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir);
> + int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV;
>

Nice catch!

Thanks,
//richard


\
 
 \ /
  Last update: 2015-11-20 11:41    [W:0.041 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site