Declare the show function and let procfs open and free the seq_file. ->proc_open() only does the checks now and ->proc_release() only drops the MTRRs the file added.
Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- arch/x86/kernel/cpu/mtrr/if.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 4049235b1bfe..9510e01d5103 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c @@ -349,7 +349,7 @@ static int mtrr_close(struct inode *ino, struct file *file) kfree(fcount); FILE_FCOUNT(file) = NULL; } - return single_release(ino, file); + return 0; } static int mtrr_seq_show(struct seq_file *seq, void *offset) @@ -391,13 +391,12 @@ static int mtrr_open(struct inode *inode, struct file *file) return -ENXIO; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - return single_open(file, mtrr_seq_show, NULL); + return 0; } static const struct proc_ops mtrr_proc_ops = { + .proc_show = mtrr_seq_show, .proc_open = mtrr_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, .proc_write = mtrr_write, .proc_ioctl = mtrr_ioctl, #ifdef CONFIG_COMPAT -- 2.53.0
