lkml.org 
[lkml]   [2009]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateWed, 9 Sep 2009 13:39:56 -0700
FromAndrew Morton <>
SubjectRe: [PATCH 3/3] viafb: use read-only mode parsing
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.



\
 
 \ /
  Last update: 2009-09-09 22:43    [from the cache]
©2003-2010