[PATCH] uacce: fix some coding styles

Zhangfei Gao zhangfei.gao at linaro.org
Tue Jul 21 16:57:57 AEST 2020



On 2020/7/20 下午3:18, Kai Ye wrote:
> 1. add some parameter check.
> 2. delete some redundant code.
> 3. modify the module author information.
>
> Signed-off-by: Kai Ye <yekai13 at huawei.com>
> Reviewed-by: Zhou Wang <wangzhou1 at hisilicon.com>
Thanks Kai.
> ---
>   drivers/misc/uacce/uacce.c | 28 +++++++++++++---------------
>   1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
> index 107028e..2e1af58 100644
> --- a/drivers/misc/uacce/uacce.c
> +++ b/drivers/misc/uacce/uacce.c
> @@ -63,8 +63,12 @@ static long uacce_fops_unl_ioctl(struct file *filep,
>   				 unsigned int cmd, unsigned long arg)
>   {
>   	struct uacce_queue *q = filep->private_data;
> -	struct uacce_device *uacce = q->uacce;
> +	struct uacce_device *uacce;
> +
> +	if (WARN_ON(!q))
> +		return -EINVAL;
WARN_ON should not be used in uacce, instead error can be printed in 
user space driver.
Error should not be printed in kernel log as pasid can be used by unpriv 
user.

And I think we do not need check filep->private_data.
The fd is double checked in __fget_files.

Thanks


More information about the Linux-accelerators mailing list