delete req malloc
authorzsq <zsq@rock-chips.com>
Sun, 30 Dec 2012 03:00:28 +0000 (11:00 +0800)
committerzsq <zsq@rock-chips.com>
Sun, 30 Dec 2012 03:00:28 +0000 (11:00 +0800)
drivers/video/rockchip/rga/rga_drv.c

index 64fe0ce4a4968fd41ece9c54d0bf68c17029d04d..a37e3c6570f960f14fc191ea18ad298b7880be4b 100755 (executable)
@@ -915,7 +915,7 @@ static int rga_blit_sync(rga_session *session, struct rga_req *req)
 \r
 static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)\r
 {\r
-    struct rga_req *req;\r
+    struct rga_req req;\r
        int ret = 0;\r
     rga_session *session;\r
 \r
@@ -929,28 +929,22 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)
         mutex_unlock(&rga_service.mutex);\r
                return -EINVAL;\r
        }\r
-    \r
-    req = kzalloc(sizeof(struct rga_req), GFP_KERNEL);\r
-    if(req == NULL)\r
-    {\r
-        printk("%s [%d] get rga_req mem failed\n",__FUNCTION__,__LINE__);\r
-        mutex_unlock(&rga_service.mutex);\r
-        return -EINVAL;\r
-    }\r
+\r
+    memset(&req, 0x0, sizeof(req));    \r
        \r
        switch (cmd)\r
        {\r
                case RGA_BLIT_SYNC:\r
-               if (unlikely(copy_from_user(req, (struct rga_req*)arg, sizeof(struct rga_req))))\r
+               if (unlikely(copy_from_user(&req, (struct rga_req*)arg, sizeof(struct rga_req))))\r
             {\r
                        ERR("copy_from_user failed\n");\r
                        ret = -EFAULT;\r
                 break;\r
                }\r
-            ret = rga_blit_sync(session, req);\r
+            ret = rga_blit_sync(session, &req);\r
             break;\r
                case RGA_BLIT_ASYNC:\r
-               if (unlikely(copy_from_user(req, (struct rga_req*)arg, sizeof(struct rga_req))))\r
+               if (unlikely(copy_from_user(&req, (struct rga_req*)arg, sizeof(struct rga_req))))\r
             {\r
                        ERR("copy_from_user failed\n");\r
                        ret = -EFAULT;\r
@@ -959,11 +953,11 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)
 \r
             if((atomic_read(&rga_service.total_running) > 16))\r
             {\r
-                           ret = rga_blit_sync(session, req);\r
+                           ret = rga_blit_sync(session, &req);\r
             }\r
             else\r
             {\r
-                ret = rga_blit_async(session, req);\r
+                ret = rga_blit_async(session, &req);\r
             }\r
                        break;\r
                case RGA_FLUSH:\r
@@ -982,8 +976,6 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)
                        break;\r
        }\r
 \r
-    kfree(req);\r
-\r
        mutex_unlock(&rga_service.mutex);\r
     \r
        return ret;\r