Skip to content

Commit 0e4699e

Browse files
Dan Carpenterdhowells
authored andcommitted
rxrpc: checking for IS_ERR() instead of NULL
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: be6e670 ('rxrpc: Rework peer object handling to use hash table and RCU') Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent 0e9390e commit 0e4699e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

net/rxrpc/af_rxrpc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ struct rxrpc_transport *rxrpc_name_to_transport(struct rxrpc_sock *rx,
247247

248248
/* find a remote transport endpoint from the local one */
249249
peer = rxrpc_lookup_peer(rx->local, srx, gfp);
250-
if (IS_ERR(peer))
251-
return ERR_CAST(peer);
250+
if (!peer)
251+
return ERR_PTR(-ENOMEM);
252252

253253
/* find a transport */
254254
trans = rxrpc_get_transport(rx->local, peer, gfp);

net/rxrpc/call_accept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
9696
notification->mark = RXRPC_SKB_MARK_NEW_CALL;
9797

9898
peer = rxrpc_lookup_peer(local, srx, GFP_NOIO);
99-
if (IS_ERR(peer)) {
99+
if (!peer) {
100100
_debug("no peer");
101101
ret = -EBUSY;
102102
goto error;

net/rxrpc/input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
639639
rxrpc_get_addr_from_skb(local, skb, &srx);
640640
rcu_read_lock();
641641
peer = rxrpc_lookup_peer_rcu(local, &srx);
642-
if (IS_ERR(peer))
642+
if (!peer)
643643
goto cant_find_peer;
644644

645645
trans = rxrpc_find_transport(local, peer);

0 commit comments

Comments
 (0)