Re: [PATCH 1/2] staging: android: logger: Allocate logs dynamicallyat boot (v2)

From: Tim Bird
Date: Thu May 10 2012 - 17:29:08 EST

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-> = kstrdup(log_name, GFP_KERNEL);
>> + if (log-> == 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?
-- Tim

Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at