[PATCH] net: fix err_cast.cocci warnings
From: kernel test robot
Date: Thu Mar 31 2022 - 19:33:44 EST
From: kernel test robot <lkp@xxxxxxxxx>
net/socket.c:1571:9-16: WARNING: ERR_CAST can be used with sock
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
Generated by: scripts/coccinelle/api/err_cast.cocci
Fixes: 3af464ccde38 ("net: add __sys_socket_file()")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: kernel test robot <lkp@xxxxxxxxx>
---
tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/sock-nolock
head: 8698873371093e22f708c2cf3a31f4dc2caab84f
commit: 3af464ccde389a5df95af3e221d098ac34d4606f [7/9] net: add __sys_socket_file()
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
net/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/socket.c
+++ b/net/socket.c
@@ -1568,7 +1568,7 @@ struct file *__sys_socket_direct(int fam
sock = __sys_socket_create(family, type, protocol);
if (IS_ERR(sock))
- return ERR_PTR(PTR_ERR(sock));
+ return ERR_CAST(sock);
flags = type & ~SOCK_TYPE_MASK;
if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))