driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Replace dynamically allocated param with local variable to save unnecessary procedure. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- .../soc/hisilicon/hisi_soc_cache_framework.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index cceeef1b3b12..38bd04be7f32 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -499,29 +499,22 @@ static int __hisi_soc_cache_maintain(unsigned long __user vaddr, size_t size, static long hisi_soc_cache_mgmt_ioctl(struct file *file, u32 cmd, unsigned long arg) { - struct hisi_soc_cache_ioctl_param *param = - kzalloc(sizeof(struct hisi_soc_cache_ioctl_param), GFP_KERNEL); + struct hisi_soc_cache_ioctl_param param; long ret; - if (!param) - return -ENOMEM; - - if (copy_from_user(param, (void __user *)arg, sizeof(*param))) { - ret = -EFAULT; - goto out; - } + if (copy_from_user(¶m, (void __user *)arg, sizeof(param))) + return -EFAULT; switch (cmd) { case HISI_CACHE_MAINTAIN: - ret = __hisi_soc_cache_maintain(param->addr, param->size, - param->op_type); + ret = __hisi_soc_cache_maintain(param.addr, param.size, + param.op_type); break; default: ret = -EINVAL; break; } -out: - kfree(param); + return ret; } -- 2.33.0