Re: [RFC PATCH V2 1/2] introduce ALS sysfs class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux