linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] UBI: fix return error code
@ 2015-11-20 10:14 Sudip Mukherjee
  2015-11-20 10:17 ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-11-20 10:14 UTC (permalink / raw)
  To: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
	Brian Norris
  Cc: linux-kernel, linux-mtd, 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;
 
 		pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n",
 		       err);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] UBI: fix return error code
  2015-11-20 10:14 [PATCH] UBI: fix return error code Sudip Mukherjee
@ 2015-11-20 10:17 ` Richard Weinberger
  2015-12-09 12:02   ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2015-11-20 10:17 UTC (permalink / raw)
  To: Sudip Mukherjee, Artem Bityutskiy, David Woodhouse, Brian Norris
  Cc: linux-kernel, linux-mtd

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] UBI: fix return error code
  2015-11-20 10:17 ` Richard Weinberger
@ 2015-12-09 12:02   ` Sudip Mukherjee
  2015-12-09 12:07     ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-12-09 12:02 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, linux-kernel,
	linux-mtd

On Fri, Nov 20, 2015 at 11:17:55AM +0100, Richard Weinberger wrote:
> 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!

Hi Richard,
It is still not on linus-next. Did you miss it?

regards
sudip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] UBI: fix return error code
  2015-12-09 12:02   ` Sudip Mukherjee
@ 2015-12-09 12:07     ` Richard Weinberger
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2015-12-09 12:07 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, linux-kernel,
	linux-mtd

Am 09.12.2015 um 13:02 schrieb Sudip Mukherjee:
> On Fri, Nov 20, 2015 at 11:17:55AM +0100, Richard Weinberger wrote:
>> 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!
> 
> Hi Richard,
> It is still not on linus-next. Did you miss it?

I did not miss it, currently I'm traveling a lot and the
days before xmas are always super crazy here.
That's why I'm horrible backlogged.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-09 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 10:14 [PATCH] UBI: fix return error code Sudip Mukherjee
2015-11-20 10:17 ` Richard Weinberger
2015-12-09 12:02   ` Sudip Mukherjee
2015-12-09 12:07     ` Richard Weinberger

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).