From: Greg KH <greg@kroah.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Pavel Machek <pavel@ucw.cz>, Len Brown <lenb@kernel.org>,
Richard Purdie <rpurdie@rpsys.net>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
"Valdis.Kletnieks@vt.edu" <Valdis.Kletnieks@vt.edu>
Subject: Re: [RFC PATCH V2 1/2] introduce ALS sysfs class
Date: Thu, 6 Aug 2009 11:56:02 -0700 [thread overview]
Message-ID: <20090806185602.GC28664@kroah.com> (raw)
In-Reply-To: <1249547498.2670.499.camel@rzhang-dt>
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
prev parent reply other threads:[~2009-08-06 18:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 8:31 [RFC PATCH V2 1/2] introduce ALS sysfs class Zhang Rui
2009-08-06 15:08 ` Bjorn Helgaas
2009-08-06 18:53 ` Greg KH
2009-08-06 18:56 ` Greg KH [this message]
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=20090806185602.GC28664@kroah.com \
--to=greg@kroah.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=bjorn.helgaas@hp.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=pavel@ucw.cz \
--cc=rpurdie@rpsys.net \
--cc=rui.zhang@intel.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