From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83AFAC4167B for ; Wed, 19 Oct 2022 11:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbiJSLzB (ORCPT ); Wed, 19 Oct 2022 07:55:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231990AbiJSLyi (ORCPT ); Wed, 19 Oct 2022 07:54:38 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99E9425294; Wed, 19 Oct 2022 04:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666179215; x=1697715215; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CaxojcYcAZw4upBW1HT4c5H++7CWh87JUubekKn7h3k=; b=O4T1E3THyNWOlT3xQCY7iU4pIXac0srkxNTZgw9y8In9J6mCiomRhNlJ AevalKocmVck3Z+DvXnhFTulL8btGU8PsL8SLkNWX8nGHSYYnFYrtWBat b+nOeyUzZYMeZYT4XouRnIKHw00gyDUWcmp/XYfBh6P/E4XeNBym6BHWC 4n/sLMM/gIvQDZ812FsSgbDHtWefQpqywjkV5JUAgjn9opqiwPf+wpVpH S7Ai9qSwXrzFWhdHwoYk1CCqA9c3z/ZYp4B0p2oKxnwbhMfKudQpqs9RD olEU6LABdNPwhGPybMnrgbcu3abJPCxnhDOl0DFVEgKdCt6L4GGvl56CU Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="307488813" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="307488813" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 04:20:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="874385927" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="874385927" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga006.fm.intel.com with ESMTP; 19 Oct 2022 04:20:28 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1ol77a-009pMs-09; Wed, 19 Oct 2022 14:20:26 +0300 Date: Wed, 19 Oct 2022 14:20:25 +0300 From: Andy Shevchenko To: Petr Mladek Cc: Russell King , Arnd Bergmann , Lee Jones , Linus Walleij , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , devicetree@vger.kernel.org, Hector Martin , Jonathan Corbet , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, Rasmus Villemoes , Rob Herring , Sergey Senozhatsky , Steven Rostedt , Sven Peter Subject: Re: [PATCH 4/7] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Wed, Oct 19, 2022 at 12:00:23PM +0200, Petr Mladek wrote: > On Tue 2022-09-06 14:19:44, Russell King wrote: > > From: Hector Martin ... > > for (i = 0; i < sizeof(u32); i++) { > > - unsigned char c = val >> (i * 8); > > + unsigned char c = val >> ((3 - i) * 8); > > This hardcodes '3' but the for-cycle uses i < sizeof(u32). > We should be consistent. > > A solution would be: > > int i; > > for (i = sizeof(u32); --i >= 0;) { > unsigned char c = val >> (i * 8); With while-loop it might be more readable: unsigned int i = sizeof(u32); while (i--) { ... } > > /* Print non-control ASCII characters as-is, dot otherwise */ > > *p++ = isascii(c) && isprint(c) ? c : '.'; > > } -- With Best Regards, Andy Shevchenko