]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'x86-microcode-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Jan 2011 19:06:09 +0000 (11:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Jan 2011 19:06:09 +0000 (11:06 -0800)
* 'x86-microcode-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, microcode, AMD: Cleanup code a bit
  x86, microcode, AMD: Replace vmalloc+memset with vzalloc

1  2 
arch/x86/kernel/microcode_amd.c

index ce0cb4721c9ac9eec8869e64c1fcd1a1ef0fd379,15831336bda838b273b089f7b6c4651b5dfed9ef..0fe6d1a66c38cf0aaea3383ac000eefbb5d34fca
@@@ -155,12 -155,6 +155,6 @@@ static int apply_microcode_amd(int cpu
        return 0;
  }
  
- static int get_ucode_data(void *to, const u8 *from, size_t n)
- {
-       memcpy(to, from, n);
-       return 0;
- }
  static void *
  get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
  {
        u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
        void *mc;
  
-       if (get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR))
-               return NULL;
+       get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR);
  
        if (section_hdr[0] != UCODE_UCODE_TYPE) {
                pr_err("error: invalid type field in container file section header\n");
                return NULL;
        }
  
-       mc = vmalloc(UCODE_MAX_SIZE);
-       if (mc) {
-               memset(mc, 0, UCODE_MAX_SIZE);
-               if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
-                                  total_size)) {
-                       vfree(mc);
-                       mc = NULL;
-               } else
-                       *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
-       }
+       mc = vzalloc(UCODE_MAX_SIZE);
+       if (!mc)
+               return NULL;
+       get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size);
+       *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
        return mc;
  }
  
@@@ -202,8 -192,7 +192,7 @@@ static int install_equiv_cpu_table(cons
        unsigned int *buf_pos = (unsigned int *)container_hdr;
        unsigned long size;
  
-       if (get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE))
-               return 0;
+       get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE);
  
        size = buf_pos[2];
  
                return 0;
        }
  
 -      equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
 +      equiv_cpu_table = vmalloc(size);
        if (!equiv_cpu_table) {
                pr_err("failed to allocate equivalent CPU table\n");
                return 0;
        }
  
        buf += UCODE_CONTAINER_HEADER_SIZE;
-       if (get_ucode_data(equiv_cpu_table, buf, size)) {
-               vfree(equiv_cpu_table);
-               return 0;
-       }
+       get_ucode_data(equiv_cpu_table, buf, size);
  
        return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
  }