Re: [PATCH] ethernet: atheros: Add nss-gmac driver

From: Stephen Hemminger
Date: Thu Jan 15 2015 - 21:00:56 EST


On Thu, 8 Jan 2015 14:03:46 -0800
Stephen Wang <wstephen@xxxxxxxxxxxxxx> wrote:

> +static int32_t nss_gmac_setup_tx_desc_queue(struct nss_gmac_dev *gmacdev,
> + struct device *dev,
> + uint32_t no_of_desc,
> + uint32_t desc_mode)
> +{
> + int32_t i;
> + struct dma_desc *first_desc = NULL;
> + dma_addr_t dma_addr;
> +
> + gmacdev->tx_desc_count = 0;
> +
> + BUG_ON(desc_mode != RINGMODE);
> + BUG_ON((no_of_desc & (no_of_desc - 1)) != 0);
> +
> + netdev_dbg(gmacdev->netdev, "Total size of memory required for Tx Descriptors in Ring Mode = 0x%08x"
> + , (uint32_t) ((sizeof(struct dma_desc) * no_of_desc)));
> +
> + first_desc = dma_alloc_coherent(dev, sizeof(struct dma_desc) * no_of_desc
> + , &dma_addr, GFP_KERNEL);
> + if (first_desc == NULL) {

In a lot of places you first initialize a variable then assign it 5 lines
later to it's initial value. Get rid of the first initialization.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/