[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5cfc763a-2d9a-4d87-8728-19db3f8e096d@redhat.com>
Date: Tue, 22 Oct 2024 11:37:07 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
Mina Almasry <almasrymina@...gle.com>
Subject: Re: [PATCH net-next v4 03/12] selftests: ncdevmem: Unify error
handling
On 10/16/24 22:34, Stanislav Fomichev wrote:
> There is a bunch of places where error() calls look out of place.
> Use the same error(1, errno, ...) pattern everywhere.
>
> Reviewed-by: Mina Almasry <almasrymina@...gle.com>
> Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
> ---
> tools/testing/selftests/net/ncdevmem.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c
> index 9b3ca6398a9d..57437c34fdd2 100644
> --- a/tools/testing/selftests/net/ncdevmem.c
> +++ b/tools/testing/selftests/net/ncdevmem.c
> @@ -340,32 +340,32 @@ int do_server(struct memory_buffer *mem)
>
> ret = inet_pton(server_sin.sin_family, server_ip, &server_sin.sin_addr);
> if (socket < 0)
> - error(79, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> + error(1, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
The above statements should probably be:
if (ret < 0)
error(1, errno, ...
>
> socket_fd = socket(server_sin.sin_family, SOCK_STREAM, 0);
> if (socket < 0)
The above statements should probably be:
if (socket_fd < 0)
AFAICS 'socket' here is the syscall function pointer. I found it strange
the compiler does not warn?!?
Thanks,
Paolo
Powered by blists - more mailing lists