]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
r8169: simplify rtl8169_alloc_rx_data
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 17 Apr 2018 21:22:14 +0000 (23:22 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Apr 2018 01:11:58 +0000 (21:11 -0400)
dev->dev.parent has the same value as tp_to_dev(tp)
(set by SET_NETDEV_DEV() in rtl_init_one()) and we know it can't be NULL.
This allows us to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index 34447a2e376353935a4e33b15fc2bd5db765dac6..0216ca71d1aa8b771946b8c827575d71806d0498 100644 (file)
@@ -6731,8 +6731,7 @@ static struct sk_buff *rtl8169_alloc_rx_data(struct rtl8169_private *tp,
        void *data;
        dma_addr_t mapping;
        struct device *d = tp_to_dev(tp);
-       struct net_device *dev = tp->dev;
-       int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
+       int node = dev_to_node(d);
 
        data = kmalloc_node(rx_buf_sz, GFP_KERNEL, node);
        if (!data)