[PATCH] drm/nouveau/gem: fix err_cast.cocci warnings

From: kernel test robot
Date: Thu Aug 13 2020 - 09:12:39 EST


From: kernel test robot <lkp@xxxxxxxxx>

drivers/gpu/drm/nouveau/nouveau_gem.c:589:9-16: WARNING: ERR_CAST can be used with mem


Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

Generated by: scripts/coccinelle/api/err_cast.cocci

CC: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: kernel test robot <lkp@xxxxxxxxx>
---

url: https://github.com/0day-ci/linux/commits/Markus-Elfring/drm-nouveau-gem-Use-vmemdup_user-rather-than-duplicating-its-implementation/20200812-150757
base: git://anongit.freedesktop.org/drm-intel for-linux-next

nouveau_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -586,7 +586,7 @@ u_memcpya(uint64_t user, unsigned nmemb,
size *= nmemb;
mem = vmemdup_user(userptr, size);
if (IS_ERR(mem))
- return ERR_PTR(PTR_ERR(mem));
+ return ERR_CAST(mem);

return mem;
}