public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Tim Bird <tim.bird@am.sony.com>
Cc: Brian Swetland <swetland@google.com>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] staging: android: logger: Allocate logs dynamically at boot (v2)
Date: Thu, 10 May 2012 14:39:20 -0700	[thread overview]
Message-ID: <20120510213920.GA31091@kroah.com> (raw)
In-Reply-To: <4FAC3336.3010609@am.sony.com>

On Thu, May 10, 2012 at 02:29:26PM -0700, Tim Bird wrote:
> On 05/10/2012 02:21 PM, Greg KH wrote:
> > On Thu, May 10, 2012 at 02:16:31PM -0700, Tim Bird wrote:
> >> +	log->misc.minor = MISC_DYNAMIC_MINOR;
> >> +	log->misc.name = kstrdup(log_name, GFP_KERNEL);
> >> +	if (log->misc.name == NULL) {
> >> +		ret = -1;
> >> +		goto out_free_log;
> > 
> > Please return a "real" error number, not just -1.  You do this a few
> > times in this function, -EINVAL perhaps?  -1 is -EPERM, which is not
> > what you want to be saying here, right?
> 
> You're right.  This is only called by init code now, which doesn't
> look at the return value (only checks for non-zero), but the intent
> is to change this going forward, so a real error number is called for.
> 
> These are all memory allocation failures, so I'm thinking of using
> -ENOMEM.  Would that be right?

Yes, sorry, I missed that, -ENOMEM is correct

I was looking at the place where the lookup failed to find the log
specified, you should return a proper error for that as well.

thanks,

greg k-h

  reply	other threads:[~2012-05-10 21:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 21:16 [PATCH 1/2] staging: android: logger: Allocate logs dynamically at boot (v2) Tim Bird
2012-05-10 21:21 ` Greg KH
2012-05-10 21:29   ` Tim Bird
2012-05-10 21:39     ` Greg KH [this message]
2012-05-10 22:11       ` [PATCH 1/2] staging: android: logger: Allocate logs dynamically at boot (v3) Tim Bird
2012-05-10 21:22 ` [PATCH 2/2] staging: android: logger: Fix some sparse and whitespace issues Tim Bird

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=20120510213920.GA31091@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swetland@google.com \
    --cc=tim.bird@am.sony.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox