All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uacce: fix some coding styles
@ 2020-07-20  7:18 Kai Ye
  2020-07-21  6:57 ` Zhangfei Gao
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Ye @ 2020-07-20  7:18 UTC (permalink / raw)
  To: linux-accelerators, linux-kernel, linuxarm, zhangfei.gao; +Cc: Kai Ye

1. add some parameter check.
2. delete some redundant code.
3. modify the module author information.

Signed-off-by: Kai Ye <yekai13@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
---
 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;
 
+	uacce = q->uacce;
 	switch (cmd) {
 	case UACCE_CMD_START_Q:
 		return uacce_start_queue(q);
@@ -206,11 +210,16 @@ static const struct vm_operations_struct uacce_vm_ops = {
 static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
 {
 	struct uacce_queue *q = filep->private_data;
-	struct uacce_device *uacce = q->uacce;
-	struct uacce_qfile_region *qfr;
 	enum uacce_qfrt type = UACCE_MAX_REGION;
+	struct uacce_qfile_region *qfr;
+	struct uacce_device *uacce;
 	int ret = 0;
 
+	if (WARN_ON(!q))
+		return -EINVAL;
+
+	uacce = q->uacce;
+
 	if (vma->vm_pgoff < UACCE_MAX_REGION)
 		type = vma->vm_pgoff;
 	else
@@ -239,17 +248,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
 
 	switch (type) {
 	case UACCE_QFRT_MMIO:
-		if (!uacce->ops->mmap) {
-			ret = -EINVAL;
-			goto out_with_lock;
-		}
-
-		ret = uacce->ops->mmap(q, vma, qfr);
-		if (ret)
-			goto out_with_lock;
-
-		break;
-
 	case UACCE_QFRT_DUS:
 		if (!uacce->ops->mmap) {
 			ret = -EINVAL;
@@ -541,5 +539,5 @@ subsys_initcall(uacce_init);
 module_exit(uacce_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Hisilicon Tech. Co., Ltd.");
+MODULE_AUTHOR("HiSilicon Tech. Co., Ltd.");
 MODULE_DESCRIPTION("Accelerator interface for Userland applications");
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-07-20  7:18 [PATCH] uacce: fix some coding styles Kai Ye
@ 2020-07-21  6:57 ` Zhangfei Gao
  0 siblings, 0 replies; 9+ messages in thread
From: Zhangfei Gao @ 2020-07-21  6:57 UTC (permalink / raw)
  To: Kai Ye, linux-accelerators, linux-kernel, linuxarm



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@huawei.com>
> Reviewed-by: Zhou Wang <wangzhou1@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-09-14  2:29 Kai Ye
@ 2020-09-14  7:59 ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2020-09-14  7:59 UTC (permalink / raw)
  To: Kai Ye; +Cc: linux-accelerators, linux-kernel, linuxarm, zhangfei.gao

On Mon, 14 Sep 2020 10:29:07 +0800
Kai Ye <yekai13@huawei.com> wrote:

> 1. delete some redundant code.
> 2. modify the module author information.
> 
> Signed-off-by: Kai Ye <yekai13@huawei.com>
> Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
> Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Two things, so should really be two patches.

> ---
> Changes in V2:
> 	deleted extra NULL pointer check in uacce_fops.
> 
>  drivers/misc/uacce/uacce.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
> index 107028e..1d09707 100644
> --- a/drivers/misc/uacce/uacce.c
> +++ b/drivers/misc/uacce/uacce.c
> @@ -239,17 +239,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
>  
>  	switch (type) {
>  	case UACCE_QFRT_MMIO:
> -		if (!uacce->ops->mmap) {
> -			ret = -EINVAL;
> -			goto out_with_lock;
> -		}
> -
> -		ret = uacce->ops->mmap(q, vma, qfr);
> -		if (ret)
> -			goto out_with_lock;
> -
> -		break;
> -
>  	case UACCE_QFRT_DUS:
>  		if (!uacce->ops->mmap) {
>  			ret = -EINVAL;
> @@ -541,5 +530,5 @@ subsys_initcall(uacce_init);
>  module_exit(uacce_exit);
>  
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Hisilicon Tech. Co., Ltd.");
> +MODULE_AUTHOR("HiSilicon Tech. Co., Ltd.");
>  MODULE_DESCRIPTION("Accelerator interface for Userland applications");



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] uacce: fix some coding styles
@ 2020-09-14  2:29 Kai Ye
  2020-09-14  7:59 ` Jonathan Cameron
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Ye @ 2020-09-14  2:29 UTC (permalink / raw)
  To: linux-accelerators, linux-kernel, linuxarm, zhangfei.gao; +Cc: Kai Ye

1. delete some redundant code.
2. modify the module author information.

Signed-off-by: Kai Ye <yekai13@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
Changes in V2:
	deleted extra NULL pointer check in uacce_fops.

 drivers/misc/uacce/uacce.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index 107028e..1d09707 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -239,17 +239,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
 
 	switch (type) {
 	case UACCE_QFRT_MMIO:
-		if (!uacce->ops->mmap) {
-			ret = -EINVAL;
-			goto out_with_lock;
-		}
-
-		ret = uacce->ops->mmap(q, vma, qfr);
-		if (ret)
-			goto out_with_lock;
-
-		break;
-
 	case UACCE_QFRT_DUS:
 		if (!uacce->ops->mmap) {
 			ret = -EINVAL;
@@ -541,5 +530,5 @@ subsys_initcall(uacce_init);
 module_exit(uacce_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Hisilicon Tech. Co., Ltd.");
+MODULE_AUTHOR("HiSilicon Tech. Co., Ltd.");
 MODULE_DESCRIPTION("Accelerator interface for Userland applications");
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-09-11  7:37   ` yekai(A)
@ 2020-09-11  7:41     ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2020-09-11  7:41 UTC (permalink / raw)
  To: yekai(A); +Cc: Zhangfei Gao, linux-accelerators, linux-kernel, linuxarm

On Fri, Sep 11, 2020 at 03:37:25PM +0800, yekai(A) wrote:
> Hi Hartman
> 
> Could you help to take this patch?
> Thanks.
> On 2020/7/31 11:09, Zhangfei Gao wrote:
> > 
> > 
> > On 2020/7/30 下午2:13, Kai Ye wrote:
> > > 1. delete some redundant code.
> > > 2. modify the module author information.
> > > 
> > > Signed-off-by: Kai Ye <yekai13@huawei.com>
> > Thanks Kai
> > 
> > Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> > 
> > Thanks
> > 
> > 
> 
> 

I see no patch here to take, sorry :(

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-07-31  3:09 ` Zhangfei Gao
@ 2020-09-11  7:37   ` yekai(A)
  2020-09-11  7:41     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: yekai(A) @ 2020-09-11  7:37 UTC (permalink / raw)
  To: Zhangfei Gao, linux-accelerators, linux-kernel, linuxarm, gregkh

Hi Hartman

Could you help to take this patch?
Thanks.
On 2020/7/31 11:09, Zhangfei Gao wrote:
>
>
> On 2020/7/30 下午2:13, Kai Ye wrote:
>> 1. delete some redundant code.
>> 2. modify the module author information.
>>
>> Signed-off-by: Kai Ye <yekai13@huawei.com>
> Thanks Kai
>
> Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>
> Thanks
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-07-30  6:13 Kai Ye
  2020-07-31  2:40 ` Zhou Wang
@ 2020-07-31  3:09 ` Zhangfei Gao
  2020-09-11  7:37   ` yekai(A)
  1 sibling, 1 reply; 9+ messages in thread
From: Zhangfei Gao @ 2020-07-31  3:09 UTC (permalink / raw)
  To: Kai Ye, linux-accelerators, linux-kernel, linuxarm



On 2020/7/30 下午2:13, Kai Ye wrote:
> 1. delete some redundant code.
> 2. modify the module author information.
>
> Signed-off-by: Kai Ye <yekai13@huawei.com>
Thanks Kai

Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] uacce: fix some coding styles
  2020-07-30  6:13 Kai Ye
@ 2020-07-31  2:40 ` Zhou Wang
  2020-07-31  3:09 ` Zhangfei Gao
  1 sibling, 0 replies; 9+ messages in thread
From: Zhou Wang @ 2020-07-31  2:40 UTC (permalink / raw)
  To: Kai Ye, linux-accelerators, linux-kernel, linuxarm, zhangfei.gao

On 2020/7/30 14:13, Kai Ye wrote:
> 1. delete some redundant code.
> 2. modify the module author information.
> 
> Signed-off-by: Kai Ye <yekai13@huawei.com>

Fine to me.

Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>

Thanks,
Zhou

> ---
> Changes in V2:
> 	deleted extra NULL pointer check in uacce_fops.
> 
>  drivers/misc/uacce/uacce.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
> index 107028e..1d09707 100644
> --- a/drivers/misc/uacce/uacce.c
> +++ b/drivers/misc/uacce/uacce.c
> @@ -239,17 +239,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
>  
>  	switch (type) {
>  	case UACCE_QFRT_MMIO:
> -		if (!uacce->ops->mmap) {
> -			ret = -EINVAL;
> -			goto out_with_lock;
> -		}
> -
> -		ret = uacce->ops->mmap(q, vma, qfr);
> -		if (ret)
> -			goto out_with_lock;
> -
> -		break;
> -
>  	case UACCE_QFRT_DUS:
>  		if (!uacce->ops->mmap) {
>  			ret = -EINVAL;
> @@ -541,5 +530,5 @@ subsys_initcall(uacce_init);
>  module_exit(uacce_exit);
>  
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Hisilicon Tech. Co., Ltd.");
> +MODULE_AUTHOR("HiSilicon Tech. Co., Ltd.");
>  MODULE_DESCRIPTION("Accelerator interface for Userland applications");
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] uacce: fix some coding styles
@ 2020-07-30  6:13 Kai Ye
  2020-07-31  2:40 ` Zhou Wang
  2020-07-31  3:09 ` Zhangfei Gao
  0 siblings, 2 replies; 9+ messages in thread
From: Kai Ye @ 2020-07-30  6:13 UTC (permalink / raw)
  To: linux-accelerators, linux-kernel, linuxarm, zhangfei.gao; +Cc: Kai Ye

1. delete some redundant code.
2. modify the module author information.

Signed-off-by: Kai Ye <yekai13@huawei.com>
---
Changes in V2:
	deleted extra NULL pointer check in uacce_fops.

 drivers/misc/uacce/uacce.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index 107028e..1d09707 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -239,17 +239,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
 
 	switch (type) {
 	case UACCE_QFRT_MMIO:
-		if (!uacce->ops->mmap) {
-			ret = -EINVAL;
-			goto out_with_lock;
-		}
-
-		ret = uacce->ops->mmap(q, vma, qfr);
-		if (ret)
-			goto out_with_lock;
-
-		break;
-
 	case UACCE_QFRT_DUS:
 		if (!uacce->ops->mmap) {
 			ret = -EINVAL;
@@ -541,5 +530,5 @@ subsys_initcall(uacce_init);
 module_exit(uacce_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Hisilicon Tech. Co., Ltd.");
+MODULE_AUTHOR("HiSilicon Tech. Co., Ltd.");
 MODULE_DESCRIPTION("Accelerator interface for Userland applications");
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-09-14  8:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20  7:18 [PATCH] uacce: fix some coding styles Kai Ye
2020-07-21  6:57 ` Zhangfei Gao
2020-07-30  6:13 Kai Ye
2020-07-31  2:40 ` Zhou Wang
2020-07-31  3:09 ` Zhangfei Gao
2020-09-11  7:37   ` yekai(A)
2020-09-11  7:41     ` Greg KH
2020-09-14  2:29 Kai Ye
2020-09-14  7:59 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.