lkml.org 
[lkml]   [2009]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH V2 1/2] introduce ALS sysfs class
On Thu, Aug 06, 2009 at 04:31:38PM +0800, Zhang Rui wrote:
> +#define PREFIX "ALS: "

This is not used.

> + /* sys I/F */
> + result = device_create_file(&als->device, &dev_attr_illuminance);
> + if (result)
> + goto unregister_device;
> +
> + result = device_create_file(&als->device, &dev_attr_desc);
> + if (result)
> + goto unregister_device;

These should be default attributes for the device, that way they get
created before userspace is told the device is there, removing any race
conditions you will have otherwise.

> +
> + return als;
> +
> +unregister_device:
> + device_unregister(&als->device);
> + return ERR_PTR(result);

And you weren't cleaning up the file if the second one failed.

thanks,

greg k-h


\
 
 \ /
  Last update: 2009-08-06 21:01    [W:8.236 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site