On Wed, Mar 20, 2013 at 10:44:47PM +0000, brendan doyle wrote:

> Where is the inconsistency? 

There is no other case in other IB libraries or libibmad itself where
errno is expected to be set by an int returning function. int
returning functions should return +ERRNO.

> errno is still undefined, it is set in some parts of libibmad and
> not others, so nothing has changed from a consumer perspective?

Consistency would be returning +ERRNO from int functions and properly
propogating return codes from lower layers:

       if (smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0,
             srcport))
            return errno;

Would be a better modification.

> +               if (!errno)
> +                       errno = EIO;

This is funny, it is not portable to expect that errno will ever be !=
0.

> @@ -178,6 +178,7 @@ int _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, 
> int
>                 status = umad_status(rcvbuf);
> +               errno = status;

_do_madrpc already returns int, so this is not great either.

> @@ -56,6 +57,7 @@ uint8_t *sa_rpc_call(const struct ibmad_port *ibmad_port,
> void *rcvbuf,
>
>         if (portid->lid <= 0) {
>                 IBWARN("only lid routes are supported");
> +               errno = EIO;
>                 return NULL;

This one is OK.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to