소스 검색

ioctl.c: Remove unnecessary initialization

The "alloc_chrdev_region" function will dynamically choose the
major number and store it at "dev". It is unnecessary to initialize
the "dev" before the "alloc_chrdev_region" function.
linD026 3 년 전
부모
커밋
fa035da36e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      examples/ioctl.c

+ 1 - 1
examples/ioctl.c

@@ -149,7 +149,7 @@ static struct file_operations fops = {
 
 static int ioctl_init(void)
 {
-    dev_t dev = MKDEV(test_ioctl_major, 0);
+    dev_t dev;
     int alloc_ret = 0;
     int cdev_ret = 0;
     alloc_ret = alloc_chrdev_region(&dev, 0, num_of_dev, DRIVER_NAME);