net: xfrm: use __this_cpu_read per-cpu helper
[sfrench/cifs-2.6.git] / net / xfrm / xfrm_ipcomp.c
index e5246fbe36c4e661698242370b800043e12ce545..2906d520eea7c2b7636fc94f3a60f5131701f57d 100644 (file)
@@ -276,18 +276,16 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name)
        struct crypto_comp * __percpu *tfms;
        int cpu;
 
-       /* This can be any valid CPU ID so we don't need locking. */
-       cpu = raw_smp_processor_id();
 
        list_for_each_entry(pos, &ipcomp_tfms_list, list) {
                struct crypto_comp *tfm;
 
-               tfms = pos->tfms;
-               tfm = *per_cpu_ptr(tfms, cpu);
+               /* This can be any valid CPU ID so we don't need locking. */
+               tfm = __this_cpu_read(*pos->tfms);
 
                if (!strcmp(crypto_comp_name(tfm), alg_name)) {
                        pos->users++;
-                       return tfms;
+                       return pos->tfms;
                }
        }