aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/boot/compressed/mkpiggy.c16
-rw-r--r--arch/x86/kernel/msr.c2
2 files changed, 11 insertions, 7 deletions
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 958a641483dd..b669ab65bf6c 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -36,11 +36,12 @@ int main(int argc, char *argv[])
36 uint32_t olen; 36 uint32_t olen;
37 long ilen; 37 long ilen;
38 unsigned long offs; 38 unsigned long offs;
39 FILE *f; 39 FILE *f = NULL;
40 int retval = 1;
40 41
41 if (argc < 2) { 42 if (argc < 2) {
42 fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); 43 fprintf(stderr, "Usage: %s compressed_file\n", argv[0]);
43 return 1; 44 goto bail;
44 } 45 }
45 46
46 /* Get the information for the compressed kernel image first */ 47 /* Get the information for the compressed kernel image first */
@@ -48,7 +49,7 @@ int main(int argc, char *argv[])
48 f = fopen(argv[1], "r"); 49 f = fopen(argv[1], "r");
49 if (!f) { 50 if (!f) {
50 perror(argv[1]); 51 perror(argv[1]);
51 return 1; 52 goto bail;
52 } 53 }
53 54
54 55
@@ -58,12 +59,11 @@ int main(int argc, char *argv[])
58 59
59 if (fread(&olen, sizeof(olen), 1, f) != 1) { 60 if (fread(&olen, sizeof(olen), 1, f) != 1) {
60 perror(argv[1]); 61 perror(argv[1]);
61 return 1; 62 goto bail;
62 } 63 }
63 64
64 ilen = ftell(f); 65 ilen = ftell(f);
65 olen = get_unaligned_le32(&olen); 66 olen = get_unaligned_le32(&olen);
66 fclose(f);
67 67
68 /* 68 /*
69 * Now we have the input (compressed) and output (uncompressed) 69 * Now we have the input (compressed) and output (uncompressed)
@@ -91,5 +91,9 @@ int main(int argc, char *argv[])
91 printf(".incbin \"%s\"\n", argv[1]); 91 printf(".incbin \"%s\"\n", argv[1]);
92 printf("input_data_end:\n"); 92 printf("input_data_end:\n");
93 93
94 return 0; 94 retval = 0;
95bail:
96 if (f)
97 fclose(f);
98 return retval;
95} 99}
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 88458faea2f8..05266b5aae22 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -46,7 +46,7 @@ static struct class *msr_class;
46static loff_t msr_seek(struct file *file, loff_t offset, int orig) 46static loff_t msr_seek(struct file *file, loff_t offset, int orig)
47{ 47{
48 loff_t ret; 48 loff_t ret;
49 struct inode *inode = file->f_mapping->host; 49 struct inode *inode = file_inode(file);
50 50
51 mutex_lock(&inode->i_mutex); 51 mutex_lock(&inode->i_mutex);
52 switch (orig) { 52 switch (orig) {