* [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers
@ 2025-11-20 8:31 Andy Shevchenko
2025-11-24 15:08 ` Petr Mladek
2025-11-25 7:07 ` Petr Mladek
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-11-20 8:31 UTC (permalink / raw)
To: linux-kernel
Cc: Petr Mladek, Steven Rostedt, Andy Shevchenko, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton
We have two almost identical pieces that handle FORMAT_STATE_NUM case.
The differences are:
- redundant {} for one-line if-else conditional
- missing blank line after variable definitions
- inverted conditional
Unify the style of two.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/vsprintf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1591dcf0e211..822a18747908 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3015,10 +3015,11 @@ int vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args)
case FORMAT_STATE_NUM: {
unsigned long long num;
- if (fmt.size <= sizeof(int))
- num = convert_num_spec(va_arg(args, int), fmt.size, spec);
- else
+
+ if (fmt.size > sizeof(int))
num = va_arg(args, long long);
+ else
+ num = convert_num_spec(va_arg(args, int), fmt.size, spec);
str = number(str, end, num, spec);
continue;
}
@@ -3526,11 +3527,10 @@ int bstr_printf(char *buf, size_t size, const char *fmt_str, const u32 *bin_buf)
goto out;
case FORMAT_STATE_NUM:
- if (fmt.size > sizeof(int)) {
+ if (fmt.size > sizeof(int))
num = get_arg(long long);
- } else {
+ else
num = convert_num_spec(get_arg(int), fmt.size, spec);
- }
str = number(str, end, num, spec);
continue;
}
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers
2025-11-20 8:31 [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers Andy Shevchenko
@ 2025-11-24 15:08 ` Petr Mladek
2025-11-25 7:07 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2025-11-24 15:08 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, Steven Rostedt, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton
On Thu 2025-11-20 09:31:40, Andy Shevchenko wrote:
> We have two almost identical pieces that handle FORMAT_STATE_NUM case.
> The differences are:
> - redundant {} for one-line if-else conditional
> - missing blank line after variable definitions
> - inverted conditional
>
> Unify the style of two.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Looks good to me:
Reviewed-by: Petr Mladek <pmladek@suse.com>
It is a trivial change. I am going to push it right away...
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers
2025-11-20 8:31 [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers Andy Shevchenko
2025-11-24 15:08 ` Petr Mladek
@ 2025-11-25 7:07 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2025-11-25 7:07 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, Steven Rostedt, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton
On Thu 2025-11-20 09:31:40, Andy Shevchenko wrote:
> We have two almost identical pieces that handle FORMAT_STATE_NUM case.
> The differences are:
> - redundant {} for one-line if-else conditional
> - missing blank line after variable definitions
> - inverted conditional
>
> Unify the style of two.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
JFYI, the patch has been comitted into printk/linux.git,
branch for-6.19.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-25 7:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-20 8:31 [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers Andy Shevchenko
2025-11-24 15:08 ` Petr Mladek
2025-11-25 7:07 ` Petr Mladek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®