lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 7/9] vsprintf: Factor out %pO handler as kobject_string()
On (04/04/18 10:58), Petr Mladek wrote:
> static noinline_for_stack
> +char *kobject_string(char *buf, char *end, void *ptr,
> + struct printf_spec spec, const char *fmt)
> +{
> + switch (fmt[1]) {
> + case 'F':
> + return device_node_string(buf, end, ptr, spec, fmt + 1);
> + }
> +
> + WARN_ONCE(1, "Unsupported pointer format specifier: %%pO%c\n", fmt[1]);
> + return buf;
> +}
> +
> +static noinline_for_stack
> char *pointer_string(char *buf, char *end, const void *ptr,
> struct printf_spec spec)
> {
> @@ -1982,10 +1995,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> case 'G':
> return flags_string(buf, end, ptr, fmt);
> case 'O':
> - switch (fmt[1]) {
> - case 'F':
> - return device_node_string(buf, end, ptr, spec, fmt + 1);
> - }
> + return kobject_string(buf, end, ptr, spec, fmt);
> case 'x':
> return pointer_string(buf, end, ptr, spec);
> }

So, previously, unsupported 'O' would end up in ptr_to_id()

case 'O':
switch (fmt[1]) {
case 'F':
return device_node_string()
}
}

return ptr_to_id();



now we will just return `buf' without doing ptr_to_id()?

case 'O':
return kobject_string(); // which does device_node_string()
// for fmt 'O' or return buf
// for unknown fmt.
}

return ptr_to_id();


Was this your intention?

-ss

\
 
 \ /
  Last update: 2018-04-05 01:35    [W:0.207 / U:12.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site