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 <[email protected]>
---
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
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