Messages in this thread | | | Date | Mon, 11 Jun 2012 10:22:49 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH] x86/apic: Eliminate cpu_mask_to_apicid() operation |
| |
* Alexander Gordeev <agordeev@redhat.com> wrote:
> @@ -2151,7 +2134,12 @@ int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, > break; > } > > - return __default_cpu_to_apicid(cpu, apicid); > + if (likely((unsigned int)cpu < nr_cpu_ids)) { > + *apicid = per_cpu(x86_cpu_to_apicid, cpu); > + return 0; > + } else { > + return -EINVAL; > + }
The type cast is rather ugly - why not change the cpu type to unsigned int?
Also, the else block is superfluous, just make it a return -EINVAL?
Thanks,
Ingo
| |