From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1592A4503B for ; Thu, 20 Nov 2025 08:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763627508; cv=none; b=hrR6GqEnR6c7scvPnOPb+tNSBR+ekTsVTbDGxy6TO0p1yE7X2wJEW9hkWA9wGAMaSxv1j30UE8ERvpFSqDOt7IBWqZjt2CHL2Rj1IgLihrDZ/cyylQclj5IS/AV5scqau5AftFHQwJiGbeAU0bes3L//Qxlv9B67vz+32vwbfJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763627508; c=relaxed/simple; bh=fwU963RveNjPwxGMaxw8Tva+7YZtPGoQQxwA6vpJ3g0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TVhfPztDS9qTO5LAYUyLuqMm1qcxNO9Iap/eykKh5tQvd50H7E9YctPnF0saOq0rqkojnmouvgajx87gERZ7yJfnibV5FW/yXRJvbnuYOCduKIj3RPcyLjQinmUNxK++i+FHQGMkhF8jekcZ4rFjR55kh4pLgGZeYb6arR2u8fo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dTAir9Fs; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dTAir9Fs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763627507; x=1795163507; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fwU963RveNjPwxGMaxw8Tva+7YZtPGoQQxwA6vpJ3g0=; b=dTAir9FsGlY3NTb06eSOf3KnOnI//mCqHS38dG1JBdeFze47mU+cNtnM xSXQyhVkWZO91P9cyeNs9R7b8XGUOnqrwesTtCr3U3/VRu3++d7lBgO9N RHMy/EFoDVAJ5lplGoxjy6uWoXANIy18J71XM1bnEdxOgA6WDYtJ06aiV dqR9N/+NtGdLV2dPEA+ocGZmuu+3OYIPxjthG4Q7Luri9RVo7JxGghinx Pcu13V97PTN1MmtZt/DduAMW2TIjHX+mJavdLSgdf8TM5K3hIY8jzVbVZ hwIlHU3FgQlHUt2BSxXtltSsE48E7dAkWdwtVW0POO59zS4mMpLR/GxtJ Q==; X-CSE-ConnectionGUID: fYtthOF/S1qGRaceN2i37g== X-CSE-MsgGUID: JoTIp1HKS2mQ1KNvPw3P9w== X-IronPort-AV: E=McAfee;i="6800,10657,11618"; a="76297032" X-IronPort-AV: E=Sophos;i="6.19,317,1754982000"; d="scan'208";a="76297032" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2025 00:31:46 -0800 X-CSE-ConnectionGUID: OFWp2+2XR822mrdynAgcVQ== X-CSE-MsgGUID: GaLJKBWASaWAYitRU3+hfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,317,1754982000"; d="scan'208";a="195434689" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa003.jf.intel.com with ESMTP; 20 Nov 2025 00:31:44 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id B4BF696; Thu, 20 Nov 2025 09:31:42 +0100 (CET) From: Andy Shevchenko To: linux-kernel@vger.kernel.org Cc: Petr Mladek , Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton Subject: [PATCH v1 1/1] lib/vsprintf: Unify FORMAT_STATE_NUM handlers Date: Thu, 20 Nov 2025 09:31:40 +0100 Message-ID: <20251120083140.3478507-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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