Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758065AbcLON5Y (ORCPT ); Thu, 15 Dec 2016 08:57:24 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38059 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752990AbcLON5W (ORCPT ); Thu, 15 Dec 2016 08:57:22 -0500 Subject: Re: [PATCH] genirq/affinity: fix node generation from cpumask To: Thomas Gleixner , Gavin Shan References: <1481738472-2671-1-git-send-email-gpiccoli@linux.vnet.ibm.com> <20161214232425.GA13182@gwshan> Cc: linux-pci@vger.kernel.org, LKML , linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , gabriel@krisman.be, bsingharora@gmail.com From: "Guilherme G. Piccoli" Date: Thu, 15 Dec 2016 10:38:33 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16121512-0032-0000-0000-000005255598 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16121512-0033-0000-0000-000011A75EDB Message-Id: <58528EC9.3060009@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-15_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612150201 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 987 Lines: 38 On 12/15/2016 07:36 AM, Thomas Gleixner wrote: > On Thu, 15 Dec 2016, Gavin Shan wrote: >>> static int get_nodes_in_cpumask(const struct cpumask *mask, nodemask_t *nodemsk) >>> { >>> - int n, nodes; >>> + int n, nodes = 0; >>> >>> /* Calculate the number of nodes in the supplied affinity mask */ >>> - for (n = 0, nodes = 0; n < num_online_nodes(); n++) { >>> + for_each_online_node(n) >>> if (cpumask_intersects(mask, cpumask_of_node(n))) { >>> node_set(n, *nodemsk); >>> nodes++; >>> } >>> - } >>> + >> >> It'd better to keep the brackets so that we needn't add them when adding >> more code into the block next time. > > Removing the brackets is outright wrong. See: > https://marc.info/?l=linux-kernel&m=147351236615103 > > I'll fix that up when applying the patch. > > Thanks, > > tglx > Thanks you all very much for the reviews and comments - lesson learned about the brackets in multi-line if/for statements! Thanks for fixing it Thomas. Cheers, Guilherme