From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752117AbdJTPRf (ORCPT ); Fri, 20 Oct 2017 11:17:35 -0400 Received: from smtprelay0181.hostedemail.com ([216.40.44.181]:34010 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751439AbdJTPRe (ORCPT ); Fri, 20 Oct 2017 11:17:34 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2915:3138:3139:3140:3141:3142:3354:3622:3865:3866:3868:3871:3872:3874:4250:4321:4605:5007:6119:6742:7576:7903:7904:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12295:12296:12438:12555:12740:12895:13439:13894:14181:14659:14721:14819:21080:21434:21451:21627:30012:30054:30062:30069:30075:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:15,LUA_SUMMARY:none X-HE-Tag: page74_5ea46ee289d5c X-Filterd-Recvd-Size: 4552 Message-ID: <1508512648.30181.1.camel@perches.com> Subject: Re: [PATCH] MIPS: kernel: proc: Remove spurious white space in cpuinfo From: Joe Perches To: Aleksandar Markovic , linux-mips@linux-mips.org Cc: Dragan Cecavac , Aleksandar Markovic , Douglas Leung , Goran Ferenc , James Hogan , James Hogan , linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Miodrag Dinic , Paul Burton , Paul Burton , Petar Jovanovic , Raghu Gandham , Ralf Baechle Date: Fri, 20 Oct 2017 08:17:28 -0700 In-Reply-To: <1508509203-30661-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1508509203-30661-1-git-send-email-aleksandar.markovic@rt-rk.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-10-20 at 16:20 +0200, Aleksandar Markovic wrote: > From: Dragan Cecavac > > Remove unnecessary space from FPU info segment of /proc/cpuinfo. > > Signed-off-by: Dragan Cecavac > Signed-off-by: Aleksandar Markovic > --- > arch/mips/kernel/proc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c > index bd9bf52..99f9aab 100644 > --- a/arch/mips/kernel/proc.c > +++ b/arch/mips/kernel/proc.c > @@ -58,7 +58,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) > > seq_printf(m, "processor\t\t: %ld\n", n); > sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", > - cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); > + cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); > seq_printf(m, fmt, __cpu_name[n], > (version >> 4) & 0x0f, version & 0x0f, > (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); That's somewhat unpleasant code as it formats a fmt string and the compiler can not verify fmt and args. Perhaps something like the below is preferable: ---  arch/mips/kernel/proc.c | 22 +++++++++++++---------  1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index bd9bf528f19b..dda4af8fcd7b 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -38,7 +38,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)   unsigned long n = (unsigned long) v - 1;   unsigned int version = cpu_data[n].processor_id;   unsigned int fp_vers = cpu_data[n].fpu_id; - char fmt [64];   int i;    #ifdef CONFIG_SMP @@ -57,11 +56,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)   }     seq_printf(m, "processor\t\t: %ld\n", n); - sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", -       cpu_data[n].options & MIPS_CPU_FPU ? "  FPU V%d.%d" : ""); - seq_printf(m, fmt, __cpu_name[n], -       (version >> 4) & 0x0f, version & 0x0f, + seq_printf(m, "cpu model\t\t: %s V%d.%d", +    __cpu_name[n], (version >> 4) & 0x0f, version & 0x0f); + if (cpu_data[n].options & MIPS_CPU_FPU) + seq_printf(m, " FPU V%d.%d\n",         (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); + else + seq_printf(m, "\n");   seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",         cpu_data[n].udelay_val / (500000/HZ),         (cpu_data[n].udelay_val / (5000/HZ)) % 100); @@ -143,10 +144,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)   seq_printf(m, "VP\t\t\t: %d\n", cpu_vpe_id(&cpu_data[n]));  #endif   - sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", -       cpu_has_vce ? "%u" : "not available"); - seq_printf(m, fmt, 'D', vced_count); - seq_printf(m, fmt, 'I', vcei_count); + if (cpu_has_vce) { + seq_printf(m, "VCE%c exceptions\t\t: %u\n", 'D', vced_count); + seq_printf(m, "VCE%c exceptions\t\t: %u\n", 'I', vcei_count); + } else { + seq_printf(m, "VCE%c exceptions\t\t: not available\n", 'D'); + seq_printf(m, "VCE%c exceptions\t\t: not available\n", 'I'); + }     proc_cpuinfo_notifier_args.m = m;   proc_cpuinfo_notifier_args.n = n;