Skip to content

Commit 21893ab

Browse files
kirylMatthew Garrett
authored andcommitted
intel_scu_ipcutil: fix major device number handling
We need to save major device number to be able to use it for unregister_chrdev() in ipc_module_exit(). ipc_module_init() must return 0 on success, not major device number. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
1 parent 6cb8c13 commit 21893ab

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/platform/x86/intel_scu_ipcutil.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <linux/init.h>
2525
#include <asm/intel_scu_ipc.h>
2626

27-
static u32 major;
27+
static int major;
2828

2929
#define MAX_FW_SIZE 264192
3030

@@ -117,7 +117,11 @@ static const struct file_operations scu_ipc_fops = {
117117

118118
static int __init ipc_module_init(void)
119119
{
120-
return register_chrdev(0, "intel_mid_scu", &scu_ipc_fops);
120+
major = register_chrdev(0, "intel_mid_scu", &scu_ipc_fops);
121+
if (major < 0)
122+
return major;
123+
124+
return 0;
121125
}
122126

123127
static void __exit ipc_module_exit(void)

0 commit comments

Comments
 (0)