All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	JosephChan@via.com.tw, ScottFang@viatech.com.cn,
	FlorianSchandinat@gmx.de
Subject: Re: [PATCH 3/3] viafb: use read-only mode parsing
Date: Wed, 9 Sep 2009 13:39:56 -0700	[thread overview]
Message-ID: <20090909133956.c682bf4a.akpm@linux-foundation.org> (raw)
In-Reply-To: <1252290284-3668-3-git-send-email-FlorianSchandinat@gmx.de>

On Mon,  7 Sep 2009 02:24:44 +0000
Florian Tobias Schandinat <FlorianSchandinat@gmx.de> wrote:

> +static void parse_mode(const char *str, u32 *xres, u32 *yres)
> +{
> +	char *ptr;
> +
> +	*xres = simple_strtoul(str, &ptr, 10);
> +	if (ptr[0] != 'x')
> +		goto out_default;
> +
> +	*yres = simple_strtoul(&ptr[1], &ptr, 10);
> +	if (ptr[0])
> +		goto out_default;
> +
> +	return;
> +
> +out_default:
> +	printk(KERN_WARNING "viafb received invalid mode string: %s\n", str);
> +	*xres = 640;
> +	*yres = 480;
> +}

One wonders if we could use sscanf here?

The second simple_strtoul() could use strict_strtoul(), but that's not
obviously superior IMO.


  reply	other threads:[~2009-09-09 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-07  2:24 [PATCH 1/3] viafb: make module parameters visible in sysfs Florian Tobias Schandinat
2009-09-07  2:24 ` [PATCH 2/3] viafb: remove unused structure member Florian Tobias Schandinat
2009-09-07  2:24   ` [PATCH 3/3] viafb: use read-only mode parsing Florian Tobias Schandinat
2009-09-09 20:39     ` Andrew Morton [this message]
2009-09-13 19:04       ` Florian Tobias Schandinat

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=20090909133956.c682bf4a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=FlorianSchandinat@gmx.de \
    --cc=JosephChan@via.com.tw \
    --cc=ScottFang@viatech.com.cn \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.