misc: mic: SCIF Fix scif_get_new_port() error handling
There are only 2 callers of scif_get_new_port() and both appear to get
the error handling wrong. Both treat zero returns as error, but it
actually returns negative error codes and >= 0 on success.
Fixes: e9089f43c9 ("misc: mic: SCIF open close bind and listen APIs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0171114210
commit
a39284ae9d
@@ -371,11 +371,10 @@ int scif_bind(scif_epd_t epd, u16 pn)
|
|||||||
goto scif_bind_exit;
|
goto scif_bind_exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pn = scif_get_new_port();
|
ret = scif_get_new_port();
|
||||||
if (!pn) {
|
if (ret < 0)
|
||||||
ret = -ENOSPC;
|
|
||||||
goto scif_bind_exit;
|
goto scif_bind_exit;
|
||||||
}
|
pn = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ep->state = SCIFEP_BOUND;
|
ep->state = SCIFEP_BOUND;
|
||||||
@@ -649,13 +648,12 @@ int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
|
|||||||
err = -EISCONN;
|
err = -EISCONN;
|
||||||
break;
|
break;
|
||||||
case SCIFEP_UNBOUND:
|
case SCIFEP_UNBOUND:
|
||||||
ep->port.port = scif_get_new_port();
|
err = scif_get_new_port();
|
||||||
if (!ep->port.port) {
|
if (err < 0)
|
||||||
err = -ENOSPC;
|
break;
|
||||||
} else {
|
ep->port.port = err;
|
||||||
ep->port.node = scif_info.nodeid;
|
ep->port.node = scif_info.nodeid;
|
||||||
ep->conn_async_state = ASYNC_CONN_IDLE;
|
ep->conn_async_state = ASYNC_CONN_IDLE;
|
||||||
}
|
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
case SCIFEP_BOUND:
|
case SCIFEP_BOUND:
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user