All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH debugfs: implement symbolic links
Date: Tue, 13 Feb 2007 17:31:42 -0800	[thread overview]
Message-ID: <20070214013142.GB9023@suse.de> (raw)
In-Reply-To: <20070213164551.500cd390@gondolin.boeblingen.de.ibm.com>

On Tue, Feb 13, 2007 at 04:45:51PM +0100, Cornelia Huck wrote:
> On Tue, 13 Feb 2007 12:13:54 +0100,
> Peter Oberparleiter <peter.oberparleiter@de.ibm.com> wrote:
> 
> Not especially related to this patch (which just does the same as the
> other debugfs functions), but:
> 
> > + * If debugfs is not enabled in the kernel, the value -%ENODEV will be
> > + * returned.  It is not wise to check for this value, but rather, check for
> > + * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
> > + * code.
> 
> does not look like good advice for return code handling. Return code
> seems to be:
> 
> - ERR_PTR(-ENODEV) if debugfs is disabled
> - NULL if debugfs is enabled and something went wrong
> - !NULL and !IS_ERR if debugfs is enabled and all went fine
> 
> That makes it easy to get return code checking wrong (especially
> considering the comment above), and a number of callers do get it wrong.

They do?

The goal here is not to force the caller to care if debugfs is enabled
or not.

> How about changing the return code behaviour of the debugfs code, either
> 
> 1. return NULL if debugfs is disabled or something went wrong, !NULL
>    else or
> 2. return ERR_PTR(-ENODEV) if debugfs is disabled, ERR_PTR(-ESOMEERROR)
>    if something went wrong or a proper dentry if everything went fine?

Your proposal changes the logic, if NULL is returned, callers will not
know if this is just because debugfs is disabled (and they can continue
on just fine), or if a real error happened.

> At the very least we should change the misleading comment.

agreed, patches always welcome :)

thanks,

greg k-h

  reply	other threads:[~2007-02-14  1:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13 11:13 [PATCH debugfs: implement symbolic links Peter Oberparleiter
2007-02-13 15:45 ` Cornelia Huck
2007-02-14  1:31   ` Greg KH [this message]
2007-02-14  6:42     ` Cornelia Huck
2007-02-14  6:57       ` [Patch] debugfs: Remove misleading comments Cornelia Huck
2007-02-14  1:27 ` [PATCH debugfs: implement symbolic links Greg KH
2007-02-14  8:03   ` Peter 1 Oberparleiter
2007-02-14 19:45     ` Greg KH

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=20070214013142.GB9023@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.oberparleiter@de.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.