Commit 011f5659 authored by Linus Torvalds's avatar Linus Torvalds

More mtrr/if.c fixes

 - printk is not an acceptable substitute for errors
 - fix indentation of mtrr_close()
 - fix duplicate mtrr "release" fn pointer initializer
parent 7a503673
...@@ -103,27 +103,18 @@ mtrr_write(struct file *file, const char *buf, size_t len, loff_t * ppos) ...@@ -103,27 +103,18 @@ mtrr_write(struct file *file, const char *buf, size_t len, loff_t * ppos)
return err; return err;
return len; return len;
} }
if (strncmp(line, "base=", 5)) { if (strncmp(line, "base=", 5))
printk("mtrr: no \"base=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
}
base = simple_strtoull(line + 5, &ptr, 0); base = simple_strtoull(line + 5, &ptr, 0);
for (; isspace(*ptr); ++ptr) ; for (; isspace(*ptr); ++ptr) ;
if (strncmp(ptr, "size=", 5)) { if (strncmp(ptr, "size=", 5))
printk("mtrr: no \"size=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
}
size = simple_strtoull(ptr + 5, &ptr, 0); size = simple_strtoull(ptr + 5, &ptr, 0);
if ((base & 0xfff) || (size & 0xfff)) { if ((base & 0xfff) || (size & 0xfff))
printk("mtrr: size and base must be multiples of 4 kiB\n");
printk("mtrr: size: 0x%Lx base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
}
for (; isspace(*ptr); ++ptr) ; for (; isspace(*ptr); ++ptr) ;
if (strncmp(ptr, "type=", 5)) { if (strncmp(ptr, "type=", 5))
printk("mtrr: no \"type=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
}
ptr += 5; ptr += 5;
for (; isspace(*ptr); ++ptr) ; for (; isspace(*ptr); ++ptr) ;
for (i = 0; i < MTRR_NUM_TYPES; ++i) { for (i = 0; i < MTRR_NUM_TYPES; ++i) {
...@@ -138,7 +129,6 @@ mtrr_write(struct file *file, const char *buf, size_t len, loff_t * ppos) ...@@ -138,7 +129,6 @@ mtrr_write(struct file *file, const char *buf, size_t len, loff_t * ppos)
return err; return err;
return len; return len;
} }
printk("mtrr: illegal type: \"%s\"\n", ptr);
return -EINVAL; return -EINVAL;
} }
...@@ -275,8 +265,7 @@ mtrr_close(struct inode *ino, struct file *file) ...@@ -275,8 +265,7 @@ mtrr_close(struct inode *ino, struct file *file)
max = num_var_ranges; max = num_var_ranges;
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
while (fcount[i] > 0) { while (fcount[i] > 0) {
if (mtrr_del(i, 0, 0) < 0) mtrr_del(i, 0, 0);
printk("mtrr: reg %d not used\n", i);
--fcount[i]; --fcount[i];
} }
} }
...@@ -300,7 +289,6 @@ static struct file_operations mtrr_fops = { ...@@ -300,7 +289,6 @@ static struct file_operations mtrr_fops = {
.open = mtrr_open, .open = mtrr_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release,
.write = mtrr_write, .write = mtrr_write,
.ioctl = mtrr_ioctl, .ioctl = mtrr_ioctl,
.release = mtrr_close, .release = mtrr_close,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment