From: Richard Weinberger <richard@nod.at>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] UBI: fix return error code
Date: Fri, 20 Nov 2015 11:17:55 +0100 [thread overview]
Message-ID: <564EF353.2050806@nod.at> (raw)
In-Reply-To: <1448014460-1371-1-git-send-email-sudipm.mukherjee@gmail.com>
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
next prev parent reply other threads:[~2015-11-20 10:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 10:14 [PATCH] UBI: fix return error code Sudip Mukherjee
2015-11-20 10:17 ` Richard Weinberger [this message]
2015-12-09 12:02 ` Sudip Mukherjee
2015-12-09 12:07 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=564EF353.2050806@nod.at \
--to=richard@nod.at \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=sudipm.mukherjee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).