public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [patch] mtd: use correct error codes in debugfs_create()
Date: Mon, 22 Jul 2013 09:51:36 +0200	[thread overview]
Message-ID: <51ECE488.1050307@bfs.de> (raw)
In-Reply-To: <20130722055607.GF5636@mwanda>



Am 22.07.2013 07:56, schrieb Dan Carpenter:
> On Fri, Jul 19, 2013 at 08:49:38AM +0300, Dan Carpenter wrote:
>> The test here is reversed.  It should be that if "dent" is a valid error
>> code then we use it, otherwise if it is NULL then use -ENODEV.
>>
> 
> People have explained the debugfs_create API to me better and now
> I'm not sure what to do here...  debugfs_create_dir() returns a
> NULL on error and if debugfs is not enabled then it returns -ENODEV.
> We test for if (!IS_ENABLED(CONFIG_DEBUG_FS)) earlier in the
> function so it can only return NULL.
> 
> Probably I should just change the test to only test for NULL?
> 
> Otherwise I think my patch is correct.  The original code will
> return success on error (NULL return) and that was not intended.
> 

Hi Dan,
i have a simple question, what to do in case of error ?

Situation 1: debugfs_create_dir returns NULL
something went wrong dir not created
if all other debugfs_ function will check for NULL someone could even ignore the check
and let the others handle that.

Situation 2: debugfs_create_dir returns ENODOV
The man page says: please ignore
I only use i could come up with is to inform the user that no debugfs is available.
But the returning pointer would now point to an error an not the expected dentry.
So have to you make sure that it becomes NULL otherwise the other debugfs function will go crasy.
(Can this happen actually ?)
Did i miss something ?

In Summa:
may it is better for debugfs_ to return NULL instead of an error ?

re,
 wh

  reply	other threads:[~2013-07-22  7:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  5:49 [patch] mtd: use correct error codes in debugfs_create() Dan Carpenter
2013-07-22  5:56 ` Dan Carpenter
2013-07-22  7:51   ` walter harms [this message]
2013-07-22 12:47     ` Dan Carpenter
2013-07-22 20:43 ` [patch v2] mtd: tiny debugfs related fixes Dan Carpenter

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=51ECE488.1050307@bfs.de \
    --to=wharms@bfs.de \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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