rxrpc: checking for IS_ERR() instead of NULL
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 18 Jun 2016 08:44:03 +0000 (11:44 +0300)
committerDavid Howells <dhowells@redhat.com>
Wed, 22 Jun 2016 08:09:58 +0000 (09:09 +0100)
rxrpc_lookup_peer_rcu() and rxrpc_lookup_peer() return NULL on error, never
error pointers, so IS_ERR() can't be used.

Fix three callers of those functions.

Fixes: be6e6707f6ee ('rxrpc: Rework peer object handling to use hash table and RCU')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/af_rxrpc.c
net/rxrpc/call_accept.c
net/rxrpc/input.c

index c83c3c75d665730016b35bc2a6072f1f3d2b1a83..9dd160bb16d2e71b270df92f1bd369adb5a8826c 100644 (file)
@@ -247,8 +247,8 @@ struct rxrpc_transport *rxrpc_name_to_transport(struct rxrpc_sock *rx,
 
        /* find a remote transport endpoint from the local one */
        peer = rxrpc_lookup_peer(rx->local, srx, gfp);
-       if (IS_ERR(peer))
-               return ERR_CAST(peer);
+       if (!peer)
+               return ERR_PTR(-ENOMEM);
 
        /* find a transport */
        trans = rxrpc_get_transport(rx->local, peer, gfp);
index 50136c76ebd167aca9a7892756327a6b9aa83724..553b67c144e58c931fac3cb1b0f5d937b675ef1c 100644 (file)
@@ -96,7 +96,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
        notification->mark = RXRPC_SKB_MARK_NEW_CALL;
 
        peer = rxrpc_lookup_peer(local, srx, GFP_NOIO);
-       if (IS_ERR(peer)) {
+       if (!peer) {
                _debug("no peer");
                ret = -EBUSY;
                goto error;
index 47fb167af3e4e716378f9a5d5599d963494ee489..e11e4d7851272e3d6cc39d6b5776a65655f96f14 100644 (file)
@@ -639,7 +639,7 @@ static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
        rxrpc_get_addr_from_skb(local, skb, &srx);
        rcu_read_lock();
        peer = rxrpc_lookup_peer_rcu(local, &srx);
-       if (IS_ERR(peer))
+       if (!peer)
                goto cant_find_peer;
 
        trans = rxrpc_find_transport(local, peer);
This page took 0.027411 seconds and 5 git commands to generate.