mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers
Date: Thu, 20 Nov 2025 09:31:40 +0100	[thread overview]
Message-ID: <20251120083140.3478507-1-andriy.shevchenko@linux.intel.com> (raw)

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


             reply	other threads:[~2025-11-20  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20  8:31 Andy Shevchenko [this message]
2025-11-24 15:08 ` Petr Mladek
2025-11-25  7:07 ` Petr Mladek

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=20251120083140.3478507-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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

all inboxes | Powered by JetHome®