]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ftgmac100: return error in ftgmac100_alloc_rx_buf
authorJoel Stanley <joel@jms.id.au>
Tue, 25 Jul 2017 00:49:01 +0000 (10:19 +0930)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jul 2017 04:21:44 +0000 (21:21 -0700)
The error paths set err, but it's not returned.

I wondered if we should fix all of the callers to check the returned
value, but Ben explains why the code is this way:

> Most call sites ignore it on purpose. There's nothing we can do if
> we fail to get a buffer at interrupt time, so we point the buffer to
> the scratch page so the HW doesn't DMA into lalaland and lose the
> packet.
>
> The one call site that tests and can fail is the one used when brining
> the interface up. If we fail to allocate at that point, we fail the
> ifup. But as you noticed, I do have a bug not returning the error.

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/faraday/ftgmac100.c

index cdb979440ca54fda97753810a93e885afc7a5d89..34dae51effd45a19c9a2b8b607dafeaec3aa0456 100644 (file)
@@ -392,7 +392,7 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,
        struct net_device *netdev = priv->netdev;
        struct sk_buff *skb;
        dma_addr_t map;
-       int err;
+       int err = 0;
 
        skb = netdev_alloc_skb_ip_align(netdev, RX_BUF_SIZE);
        if (unlikely(!skb)) {
@@ -428,7 +428,7 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,
        else
                rxdes->rxdes0 = 0;
 
-       return 0;
+       return err;
 }
 
 static unsigned int ftgmac100_next_rx_pointer(struct ftgmac100 *priv,