From: Long Li <lon...@microsoft.com> Sent: Thursday, November 1, 2018 4:52 PM > > --- a/kernel/irq/affinity.c > +++ b/kernel/irq/affinity.c > @@ -117,12 +117,13 @@ static int irq_build_affinity_masks(const struct > irq_affinity *affd, > */ > if (numvecs <= nodes) { > for_each_node_mask(n, nodemsk) { > - cpumask_copy(masks + curvec, node_to_cpumask[n]); > - if (++done == numvecs) > - break; > + cpumask_or(masks + curvec, masks + curvec, > node_to_cpumask[n]); > + done++; > if (++curvec == last_affv) > curvec = affd->pre_vectors; > }
When the above for loop is exited, 'done' will always be equal to 'nodes' since there are no early exits from the loop. Hence there's no need to be incrementing 'done' in the loop. > + if (done > numvecs) > + done = numvecs; And if 'done' would always be equal to 'nodes', there is no need for the test. Just always set 'done' to 'numvecs'. > goto out; > } > > -- > 2.14.1