mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Eric Miao <eric.y.miao@gmail.com>,
	Jean Delvare <khali@linux-fr.org>,
	Jack Ren <jack.ren@marvell.com>
Subject: Re: [patch 2.6.26-rc-mm] gpio: max732x driver
Date: Tue, 22 Jul 2008 03:24:38 -0700	[thread overview]
Message-ID: <200807220324.38929.david-b@pacbell.net> (raw)
In-Reply-To: <20080722020542.d180162d.akpm@linux-foundation.org>

On Tuesday 22 July 2008, Andrew Morton wrote:
> > +     if ((mask & chip->dir_input) == 0) {
> > +             dev_dbg(&chip->client->dev, "%s port %d is output only\n",
> > +                     chip->client->name, off);
> > +             return -EACCES;
> 
> I don't think that EACCES is a suitable error code here.  That's a
> security/permissions sort of thing.  If userspace is requesting this
> driver to do something which the hardware cannot do then probably
> EINVAL is the appropriate return code.

EINVAL is one of the most ambiguous return codes available.  It's
worth avoiding whenever there's *ANY* more meaningful code!  In this
case, the gpio_direction_input() call is good about returning that
fault code only for bogus GPIO numbers.

EACCES is what you should get trying to open a write-only file for
reading, which seems like a very direct analogy.  That argument is
just fine... it's the particular access request which must be denied,
in this case because hardware itself disallows it rather than a bit
in an inode.

- Dave

      reply	other threads:[~2008-07-22 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14  2:18 David Brownell
2008-07-22  9:05 ` Andrew Morton
2008-07-22 10:24   ` David Brownell [this message]

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=200807220324.38929.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=eric.y.miao@gmail.com \
    --cc=jack.ren@marvell.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®