[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86, amd_ucode: remove needless cast



commit 40cbc40bea2d7c9ab4b9316d4bae1ad858c6ba91
Author:     Aravind Gopalakrishnan <aravind.gopalakrishnan@xxxxxxx>
AuthorDate: Tue Jul 29 16:51:51 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 29 16:51:51 2014 +0200

    x86, amd_ucode: remove needless cast
    
    Missed cleaning up this cast as part of 0aacc28.
    Doing that here; and we can remove 'off' variable as well,
    just use *offset in it's place.
    
    Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@xxxxxxx>
---
 xen/arch/x86/microcode_amd.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 14728a2..8f16826 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -235,27 +235,22 @@ static int get_ucode_from_buffer_amd(
     size_t bufsize,
     size_t *offset)
 {
-    const uint8_t *bufp = buf;
-    size_t off;
-    const struct mpbhdr *mpbuf;
-
-    off = *offset;
+    const struct mpbhdr *mpbuf = buf + *offset;
 
     /* No more data */
-    if ( off >= bufsize )
+    if ( *offset >= bufsize )
     {
         printk(KERN_ERR "microcode: Microcode buffer overrun\n");
         return -EINVAL;
     }
 
-    mpbuf = (const struct mpbhdr *)&bufp[off];
     if ( mpbuf->type != UCODE_UCODE_TYPE )
     {
         printk(KERN_ERR "microcode: Wrong microcode payload type field\n");
         return -EINVAL;
     }
 
-    if ( (off + mpbuf->len) > bufsize )
+    if ( (*offset + mpbuf->len) > bufsize )
     {
         printk(KERN_ERR "microcode: Bad data in microcode data file\n");
         return -EINVAL;
@@ -275,13 +270,13 @@ static int get_ucode_from_buffer_amd(
     }
     memcpy(mc_amd->mpb, mpbuf->data, mpbuf->len);
 
-    *offset = off + mpbuf->len + SECTION_HDR_SIZE;
-
     pr_debug("microcode: CPU%d size %zu, block size %u offset %zu equivID %#x 
rev %#x\n",
-             raw_smp_processor_id(), bufsize, mpbuf->len, off,
+             raw_smp_processor_id(), bufsize, mpbuf->len, *offset,
              ((struct microcode_header_amd *)mc_amd->mpb)->processor_rev_id,
              ((struct microcode_header_amd *)mc_amd->mpb)->patch_id);
 
+    *offset += mpbuf->len + SECTION_HDR_SIZE;
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.