linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Mattia Dongili <malattia@linux.it>
Cc: Andrea Gelmini <andrea.gelmini@gmail.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	anssi.hannula@iki.fi, linux-acpi@vger.kernel.org,
	axel.lin@gmail.com, trenn@suse.de, len.brown@intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: Regression 2.6.39-rc1 for sony-laptop
Date: Mon, 4 Apr 2011 10:37:17 +0300	[thread overview]
Message-ID: <BANLkTimJa3CSWouTMJD5V0ZuMa67YXy88Q@mail.gmail.com> (raw)
In-Reply-To: <20110402155549.GA6724@kamineko.org>

On 4/2/11, Mattia Dongili <malattia@linux.it> wrote:
> On Sat, Apr 02, 2011 at 02:55:38PM +0300, Dan Carpenter wrote:
>> On 4/2/11, Mattia Dongili <malattia@linux.it> wrote:
>> > --- a/drivers/platform/x86/sony-laptop.c
>> > +++ b/drivers/platform/x86/sony-laptop.c
>> > @@ -810,6 +810,11 @@ static int sony_nc_handles_cleanup(struct
>> > platform_device *pd)
>> >  static int sony_find_snc_handle(int handle)
>> >  {
>> >  	int i;
>> > +
>> > +	/* not initialized yet, return early */
>> > +	if (!handles)
>> > +		return -1;
>>
>> -1 is -EPERM.  That's not the right error code here.  Maybe -EINVAL?
>
> this error is not propagated to userspace. If necessary I can review all
> error codes in the sony-laptop internal functions (where -1 is a fairly
> common return code for error conditions).

That would be good, but it's going beyond the call of duty.  The main thing
is to not introduce new slop.

>
> I remember a discussion on LKML recently about error codes but I'm not
> sure what the outcome was (if any).
>

People sometimes think -1 is a generic error code, but it's not.  It has
a specific wrong meaning.  In fact, -1 is never the right error code.
It's should
either be -EPERM, or the appropriate error code.

regards,
dan carpenter

  reply	other threads:[~2011-04-04  7:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 17:16 Regression 2.6.39-rc1 for sony-laptop Andrea Gelmini
2011-04-01 17:22 ` Matthew Garrett
2011-04-01 17:30   ` Anssi Hannula
2011-04-02  9:45     ` Andrea Gelmini
2011-04-02  9:44   ` Andrea Gelmini
2011-04-02 10:00     ` Mattia Dongili
2011-04-02 11:55       ` Dan Carpenter
2011-04-02 15:55         ` Mattia Dongili
2011-04-04  7:37           ` Dan Carpenter [this message]
2011-04-04 23:44             ` sony-laptop: fix early NULL pointer dereference Mattia Dongili
2011-04-05  0:26               ` Thiago Farina
2011-04-05 12:50                 ` 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=BANLkTimJa3CSWouTMJD5V0ZuMa67YXy88Q@mail.gmail.com \
    --to=error27@gmail.com \
    --cc=andrea.gelmini@gmail.com \
    --cc=anssi.hannula@iki.fi \
    --cc=axel.lin@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malattia@linux.it \
    --cc=mjg59@srcf.ucam.org \
    --cc=trenn@suse.de \
    /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).