From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754337AbdJILi6 (ORCPT ); Mon, 9 Oct 2017 07:38:58 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43428 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753921AbdJILiz (ORCPT ); Mon, 9 Oct 2017 07:38:55 -0400 Subject: Re: linux-4.14-rc3/arch/powerpc/perf/imc-pmu.c:599: pointless test ? To: Michael Ellerman , David Binderman , "benh@kernel.crashing.org" , "paulus@samba.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" References: <87fuasewxv.fsf@concordia.ellerman.id.au> From: Anju T Sudhakar Date: Mon, 9 Oct 2017 17:08:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <87fuasewxv.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17100911-0004-0000-0000-0000130906DB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007866; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00928621; UDB=6.00467352; IPR=6.00708893; BA=6.00005628; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017458; XFM=3.00000015; UTC=2017-10-09 11:38:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100911-0005-0000-0000-00008466D983 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-09_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710090169 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On Monday 09 October 2017 10:31 AM, Michael Ellerman wrote: > David Binderman writes: >> Hello there, >> >> linux-4.14-rc3/arch/powerpc/perf/imc-pmu.c:599]: (style) Unsigned variable 'ncpu' can't be negative so it is unnecessary to test it. >> >> Source code is >> >> if (ncpu >= 0 && ncpu < nr_cpu_ids) { >> >> but >> >> unsigned int ncpu, core_id; >> >> Suggest remove test. Nice catch. Thanks for mentioning this. I will fix this. Thanks, Anju > Thanks. > > Notifying the author would be more helpful: > > $ git blame -L 599,599 arch/powerpc/perf/imc-pmu.c > 39a846db1d574 (Anju T Sudhakar 2017-07-19 03:06:35 +0530 599) if (ncpu >= 0 && ncpu < nr_cpu_ids) { > $ git log -1 --format=%ae 39a846db1d574 > anju@linux.vnet.ibm.com > > cheers >