Messages in this thread | | | Date | Thu, 6 Aug 2009 11:56:02 -0700 | From | Greg KH <> | Subject | Re: [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
| |