Thread (21 messages) 21 messages, 8 authors, 2017-10-12

Re: [PATCH 06/10] drivers:ethernet: return -ENOMEM on allocation failure.

From: Allen <hidden>
Date: 2017-09-13 13:04:23
Also in: dri-devel, linux-btrfs, linux-crypto, linux-scsi, lkml, netdev, nouveau, target-devel

static int cas_alloc_rxds(struct cas *cp)
{
        int i;

        for (i = 0; i < N_RX_DESC_RINGS; i++) {
                if (cas_alloc_rx_desc(cp, i) < 0) {
                        cas_free_rxds(cp);
                        return -1;
                }
        }
        return 0;
}

Again, your change is correct, but in the end the value is not used.
And if you fix it at the cas_alloc_rxds level, you also need a fix at
the next level up:

        err = -ENOMEM;
        if (cas_tx_tiny_alloc(cp) < 0)
                goto err_unlock;

        /* alloc rx descriptors */
        if (cas_alloc_rxds(cp) < 0)
                goto err_tx_tiny;

again, the return value is discarded.
 I agree. I could send out v2 with fixes at both level.

- Allen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help