[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxfLLQ7C8HV96Hzs@mini-arch>
Date: Tue, 22 Oct 2024 08:56:29 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org,
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/22, Paolo Abeni wrote:
>
>
> 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, ...
Agreed, thanks! (and it does seem like inet_pton sets the 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?!?
Huh, how did you even see that? :-D Yeah, the compiler is all happy and
quiet :-)
Powered by blists - more mailing lists