summaryrefslogtreecommitdiff
path: root/drivers/atm
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/atm
parent8ac04868315c6ffcb2c5a5ad9cd5cec61cad3576 (diff)
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/atm')
-rw-r--r--drivers/atm/nicstar.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index cb28579e8a94..d879f3bca107 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -1980,13 +1980,12 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
card->lbfqc = ns_stat_lfbqc_get(stat);
id = le32_to_cpu(rsqe->buffer_handle);
- skb = idr_find(&card->idr, id);
+ skb = idr_remove(&card->idr, id);
if (!skb) {
RXPRINTK(KERN_ERR
- "nicstar%d: idr_find() failed!\n", card->index);
+ "nicstar%d: skb not found!\n", card->index);
return;
}
- idr_remove(&card->idr, id);
dma_sync_single_for_cpu(&card->pcidev->dev,
NS_PRV_DMA(skb),
(NS_PRV_BUFTYPE(skb) == BUF_SM