Skip to content

Commit f21506c

Browse files
arndbdavem330
authored andcommitted
dpaa_eth: avoid uninitialized variable false-positive warning
We can now build this driver on ARM, so I ran into a randconfig build warning that presumably had existed on powerpc already. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c: In function 'sg_fd_to_skb': drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:1712:18: error: 'skb' may be used uninitialized in this function [-Werror=maybe-uninitialized] I'm slightly changing the logic here, to make it obvious to the compiler that 'skb' is always initialized. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 727d5fb commit f21506c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
17211721

17221722
/* Iterate through the SGT entries and add data buffers to the skb */
17231723
sgt = vaddr + fd_off;
1724+
skb = NULL;
17241725
for (i = 0; i < DPAA_SGT_MAX_ENTRIES; i++) {
17251726
/* Extension bit is not supported */
17261727
WARN_ON(qm_sg_entry_is_ext(&sgt[i]));
@@ -1738,7 +1739,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
17381739
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
17391740
dma_unmap_single(dpaa_bp->dev, sg_addr, dpaa_bp->size,
17401741
DMA_FROM_DEVICE);
1741-
if (i == 0) {
1742+
if (!skb) {
17421743
sz = dpaa_bp->size +
17431744
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
17441745
skb = build_skb(sg_vaddr, sz);

0 commit comments

Comments
 (0)