linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
To: Andrew Morton <akpm@linux-foundation.org>, Daniel Drake <dsd@laptop.org>
Cc: x86@kernel.org, mingo@redhat.com, hpa@zytor.com,
	tglx@linutronix.de, dilinger@queued.net,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: Re: [PATCH resend 2] x86, olpc-xo15-sci: Enable lid close wakeup control through sysfs
Date: Sun, 04 Dec 2011 11:50:08 +0000	[thread overview]
Message-ID: <4EDB5E70.5000209@googlemail.com> (raw)
In-Reply-To: <20111130151551.97371bdb.akpm@linux-foundation.org>

On 01/-10/37 20:59, Andrew Morton wrote:
> Let me fix that for you.
>
> --- a/arch/x86/platform/olpc/olpc-xo15-sci.c~x86-olpc-xo15-sci-enable-lid-close-wakeup-control-through-sysfs-fix
> +++ a/arch/x86/platform/olpc/olpc-xo15-sci.c
> @@ -58,7 +58,8 @@ static ssize_t lid_wake_on_close_store(s
>   				       const char *buf, size_t n)
>   {
>   	unsigned int val;
> -	if (!sscanf(buf, "%u",&val) == 1)
> +
> +	if (sscanf(buf, "%u",&val) != 1)
>   		return -EINVAL;
>
>   	set_lid_wake_behavior(!!val);
>
> It's kinda irritating that this will cheerfully accept bogus input of
> the form "42foo".  This happens about eleven billion times in sysfs
> write() handlers but afaik we've never implemented a nice
> sysfs_int_from_buffer() thingy which handles all the possible errors.

I thought there was.

strict_strtoul() ?

Alan

  reply	other threads:[~2011-12-04 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 22:24 [PATCH resend 2] x86, olpc-xo15-sci: Enable lid close wakeup control through sysfs Daniel Drake
2011-11-30 23:15 ` Andrew Morton
2011-12-04 11:50   ` Alan Jenkins [this message]
2011-12-05  5:42     ` Andrew Morton

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=4EDB5E70.5000209@googlemail.com \
    --to=alan.christopher.jenkins@googlemail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dilinger@queued.net \
    --cc=dsd@laptop.org \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).