LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drm/tegra: fix warning PTR_ERR_OR_ZERO can be used
@ 2019-05-25 7:03 Hariprasad Kelam
2019-05-26 22:27 ` Ben Dooks
0 siblings, 1 reply; 2+ messages in thread
From: Hariprasad Kelam @ 2019-05-25 7:03 UTC (permalink / raw)
To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter,
dri-devel, linux-tegra, linux-kernel
fix below warnings reported by coccicheck
/drivers/gpu/drm/tegra/drm.c:509:1-3: WARNING: PTR_ERR_OR_ZERO can be
used
./drivers/gpu/drm/tegra/gem.c:419:1-3: WARNING: PTR_ERR_OR_ZERO can be
used
Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
drivers/gpu/drm/tegra/drm.c | 6 ++----
drivers/gpu/drm/tegra/gem.c | 5 +----
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 0c5f1e6..0a8fcc1 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -506,10 +506,8 @@ static int tegra_gem_create(struct drm_device *drm, void *data,
bo = tegra_bo_create_with_handle(file, drm, args->size, args->flags,
&args->handle);
- if (IS_ERR(bo))
- return PTR_ERR(bo);
-
- return 0;
+
+ return PTR_ERR_OR_ZERO(bo);
}
static int tegra_gem_mmap(struct drm_device *drm, void *data,
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 4cce11f..6e27fc0 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -416,10 +416,7 @@ 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 vm_fault_t tegra_bo_fault(struct vm_fault *vmf)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/tegra: fix warning PTR_ERR_OR_ZERO can be used
2019-05-25 7:03 [PATCH] drm/tegra: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
@ 2019-05-26 22:27 ` Ben Dooks
0 siblings, 0 replies; 2+ messages in thread
From: Ben Dooks @ 2019-05-26 22:27 UTC (permalink / raw)
To: Hariprasad Kelam, Thierry Reding, David Airlie, Daniel Vetter,
Jonathan Hunter, dri-devel, linux-tegra, linux-kernel
On 25/05/2019 08:03, Hariprasad Kelam wrote:
> fix below warnings reported by coccicheck
>
> /drivers/gpu/drm/tegra/drm.c:509:1-3: WARNING: PTR_ERR_OR_ZERO can be
> used
> ./drivers/gpu/drm/tegra/gem.c:419:1-3: WARNING: PTR_ERR_OR_ZERO can be
> used
I'd say the coccicheck should say "Improvement:" here, it's not
something wrong, just code that has a better call available.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-26 22:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25 7:03 [PATCH] drm/tegra: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
2019-05-26 22:27 ` Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).