summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2016-12-22 13:30:22 -0500
committerMatthew Wilcox <mawilcox@microsoft.com>2017-02-13 21:44:03 -0500
commitd3e709e63e97e5f3f129b639991cfe266da60bae (patch)
tree78647f4029b9e83087fefa19144a689f6909f8d2 /drivers/net
parent8ac04868315c6ffcb2c5a5ad9cd5cec61cad3576 (diff)
downloadlinux-d3e709e63e97e5f3f129b639991cfe266da60bae.tar.gz
linux-d3e709e63e97e5f3f129b639991cfe266da60bae.tar.xz
idr: Return the deleted entry from idr_remove
It is a relatively common idiom (8 instances) to first look up an IDR entry, and then remove it from the tree if it is found, possibly doing further operations upon the entry afterwards. If we change idr_remove() to return the removed object, all of these users can save themselves a walk of the IDR tree. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/txrx.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/txrx.c b/drivers/net/wireless/marvell/mwifiex/txrx.c
index abdd0cf710bf..fac28bd8fbee 100644
--- a/drivers/net/wireless/marvell/mwifiex/txrx.c
+++ b/drivers/net/wireless/marvell/mwifiex/txrx.c
@@ -346,9 +346,7 @@ void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
return;
spin_lock_irqsave(&priv->ack_status_lock, flags);
- ack_skb = idr_find(&priv->ack_status_frames, tx_status->tx_token_id);
- if (ack_skb)
- idr_remove(&priv->ack_status_frames, tx_status->tx_token_id);
+ ack_skb = idr_remove(&priv->ack_status_frames, tx_status->tx_token_id);
spin_unlock_irqrestore(&priv->ack_status_lock, flags);
if (ack_skb) {