* [PATCH] drm/tegra: gem: Use PTR_ERR_OR_ZERO()
@ 2017-11-28 22:18 Vasyl Gomonovych
[not found] ` <1511907502-11528-1-git-send-email-gomonovych-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Vasyl Gomonovych @ 2017-11-28 22:18 UTC (permalink / raw)
To: thierry.reding, airlied, jonathanh, dri-devel, linux-tegra, gomonovych
Cc: linux-kernel
Fix ptr_ret.cocci warnings:
drivers/gpu/drm/tegra/gem.c:420:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: scripts/coccinelle/api/ptr_ret.cocci
Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
---
drivers/gpu/drm/tegra/gem.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index ab1e53d434e8..a40148cd0957 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -417,10 +417,8 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
&args->handle);
- if (IS_ERR(bo))
- return PTR_ERR(bo);
- return 0;
+ return PTR_ERR_OR_ZERO(bo);
}
static int tegra_bo_fault(struct vm_fault *vmf)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: gem: Use PTR_ERR_OR_ZERO()
2017-11-28 22:18 [PATCH] drm/tegra: gem: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
@ 2017-11-29 9:12 ` Mikko Perttunen
0 siblings, 0 replies; 3+ messages in thread
From: Mikko Perttunen @ 2017-11-29 9:12 UTC (permalink / raw)
To: Vasyl Gomonovych, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
airlied-cv59FeDIM0c, jonathanh-DDmLM1+adcrQT0dZR+AlfA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 29.11.2017 00:18, Vasyl Gomonovych wrote:
> Fix ptr_ret.cocci warnings:
> drivers/gpu/drm/tegra/gem.c:420:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Signed-off-by: Vasyl Gomonovych <gomonovych-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> drivers/gpu/drm/tegra/gem.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index ab1e53d434e8..a40148cd0957 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -417,10 +417,8 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>
> bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
> &args->handle);
> - if (IS_ERR(bo))
> - return PTR_ERR(bo);
>
> - return 0;
> + return PTR_ERR_OR_ZERO(bo);
This is semantically less clear - the current code clearly has error and
success paths while the changed code doesn't. Same for the other patch.
Cheers,
Mikko
> }
>
> static int tegra_bo_fault(struct vm_fault *vmf)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: gem: Use PTR_ERR_OR_ZERO()
@ 2017-11-29 9:12 ` Mikko Perttunen
0 siblings, 0 replies; 3+ messages in thread
From: Mikko Perttunen @ 2017-11-29 9:12 UTC (permalink / raw)
To: Vasyl Gomonovych, thierry.reding, airlied, jonathanh, dri-devel,
linux-tegra
Cc: linux-kernel
On 29.11.2017 00:18, Vasyl Gomonovych wrote:
> Fix ptr_ret.cocci warnings:
> drivers/gpu/drm/tegra/gem.c:420:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
> ---
> drivers/gpu/drm/tegra/gem.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index ab1e53d434e8..a40148cd0957 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -417,10 +417,8 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>
> bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
> &args->handle);
> - if (IS_ERR(bo))
> - return PTR_ERR(bo);
>
> - return 0;
> + return PTR_ERR_OR_ZERO(bo);
This is semantically less clear - the current code clearly has error and
success paths while the changed code doesn't. Same for the other patch.
Cheers,
Mikko
> }
>
> static int tegra_bo_fault(struct vm_fault *vmf)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-29 9:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 22:18 [PATCH] drm/tegra: gem: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
[not found] ` <1511907502-11528-1-git-send-email-gomonovych-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-29 9:12 ` Mikko Perttunen
2017-11-29 9:12 ` Mikko Perttunen
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.