From 99fbaeb146878c4f365f69e85c22716feef23fa6 Mon Sep 17 00:00:00 2001 From: zsq Date: Sun, 30 Dec 2012 11:00:28 +0800 Subject: [PATCH] delete req malloc --- drivers/video/rockchip/rga/rga_drv.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/video/rockchip/rga/rga_drv.c b/drivers/video/rockchip/rga/rga_drv.c index 64fe0ce4a496..a37e3c6570f9 100755 --- a/drivers/video/rockchip/rga/rga_drv.c +++ b/drivers/video/rockchip/rga/rga_drv.c @@ -915,7 +915,7 @@ static int rga_blit_sync(rga_session *session, struct rga_req *req) static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg) { - struct rga_req *req; + struct rga_req req; int ret = 0; rga_session *session; @@ -929,28 +929,22 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg) mutex_unlock(&rga_service.mutex); return -EINVAL; } - - req = kzalloc(sizeof(struct rga_req), GFP_KERNEL); - if(req == NULL) - { - printk("%s [%d] get rga_req mem failed\n",__FUNCTION__,__LINE__); - mutex_unlock(&rga_service.mutex); - return -EINVAL; - } + + memset(&req, 0x0, sizeof(req)); switch (cmd) { case RGA_BLIT_SYNC: - if (unlikely(copy_from_user(req, (struct rga_req*)arg, sizeof(struct rga_req)))) + if (unlikely(copy_from_user(&req, (struct rga_req*)arg, sizeof(struct rga_req)))) { ERR("copy_from_user failed\n"); ret = -EFAULT; break; } - ret = rga_blit_sync(session, req); + ret = rga_blit_sync(session, &req); break; case RGA_BLIT_ASYNC: - if (unlikely(copy_from_user(req, (struct rga_req*)arg, sizeof(struct rga_req)))) + if (unlikely(copy_from_user(&req, (struct rga_req*)arg, sizeof(struct rga_req)))) { ERR("copy_from_user failed\n"); ret = -EFAULT; @@ -959,11 +953,11 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg) if((atomic_read(&rga_service.total_running) > 16)) { - ret = rga_blit_sync(session, req); + ret = rga_blit_sync(session, &req); } else { - ret = rga_blit_async(session, req); + ret = rga_blit_async(session, &req); } break; case RGA_FLUSH: @@ -982,8 +976,6 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg) break; } - kfree(req); - mutex_unlock(&rga_service.mutex); return ret; -- 2.34.1