linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: error value for "internal error"
Date: Tue, 2 May 2017 11:37:31 -0700	[thread overview]
Message-ID: <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA@mail.gmail.com> (raw)
In-Reply-To: <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, May 2, 2017 at 7:03 AM, Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org> wrote:
> I've been wondering what to return for soft asserts like this:
>
>         if (WARN_ON(something unexpected))
>                 return -E????;
>
> EINVAL doesn't fit because it means the input from userspace was
> wrong.  EIO means something went bad with the hardware.

I think we've traditionally just used EIO for "something went wrong".
It's not necessarily hardware that went wrong.

That's particularly true when there is a WARN_ON() that then gives
more details of where this actually happened in the system logs - at
that point the error number really doesn't matter all that much.

(Ambiguous error numbers are much more annoying when something goes
wrong, but you can't tell which of 48 different cases it was that
triggered that error number).

                      Linus

  parent reply	other threads:[~2017-05-02 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 14:03 error value for "internal error" Miklos Szeredi
     [not found] ` <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-02 18:37   ` Linus Torvalds [this message]
     [not found]     ` <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-03  9:10       ` Miklos Szeredi

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='CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA@mail.gmail.com' \
    --to=torvalds-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).