lkml.org 
[lkml]   [2015]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ethernet: atheros: Add nss-gmac driver
On Thu,  8 Jan 2015 14:03:46 -0800
Stephen Wang <wstephen@codeaurora.org> 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.


\
 
 \ /
  Last update: 2015-01-16 03:41    [W:0.266 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site