From patchwork Fri Nov 3 12:52:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 117897 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp3277625edm; Fri, 3 Nov 2017 05:53:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TEC00H4+maCm3xlkz2CFqX0pETOBlOGoKCkczAPN5QRgNVB/GfogZmGHQbz2RuW6SYDZq7 X-Received: by 10.101.64.140 with SMTP id t12mr7193785pgp.305.1509713602456; Fri, 03 Nov 2017 05:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509713602; cv=none; d=google.com; s=arc-20160816; b=IyDNUWBqakF1V1APps0sG5sRyiYA4erKiiawLc1VahQqjTtHCsIdOL0eZD1fC0Ooun JWLdE9J8KCEXZ8NnHI5OBmQfeHrb3Daa5gJDmu4Zn5CX6JZPa5/PpfWsJQZUpe0TMQwq Tjb3EvvCr92hlUJ9uK6adqA2yWs+ojKTpfsLzNY3WpsHUtljsL4RpwhjS1gp8Mcja/KF PB9MTqMPSiUeer3A7e8N0ZAiabnZ4m7pkdhRiM66YupQK9wMJwpVuR/9WiSs3sNNgtFQ te51pIi99ChshrqwpuhHgeJcrH668VPnP1vtYmMi1iGh04FcVVRy40RFx/G77TEk4xHA 4Y/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3ATt9idLIWyPIa2QUxYYoL3m+kdnzgr2YKa8nbLzOFQ=; b=peNk0/kLmN6zLiEOQDGQsorZs9kXCIy/FHUJhU0kPGTH04PYHVNy29/YzVRxGZ4cMl Kzko7gD4Txd4ZvDpT3SeWwOuhVev4+Q2T6/rYPlmMvJqogp+sZliH1BBycL/gEqFHhyV 2mmUkOAPNdU+j0b1cvBnsbUBELr9aTaCJTW6cLUfbqSHd6nRLJis2mCWuK+2ES6jgdW2 LNoGneVTdBqTNQi+rrh533LauFlbwwWGzUSY0QFiQFkCCD9oBCYc1zDFMvjK9lQPPsOY BIUij1eDqnwzQN0CJ/lk1ffXeTRMTuRPSHd0XlXFhWWqaP+6rjumhlaaMNOJ3kBiRwjR xzFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si5032476pln.700.2017.11.03.05.53.22; Fri, 03 Nov 2017 05:53:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756033AbdKCMxT (ORCPT + 26 others); Fri, 3 Nov 2017 08:53:19 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:60530 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbdKCMxR (ORCPT ); Fri, 3 Nov 2017 08:53:17 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lmyuu-1dTrf62WoG-00h6QM; Fri, 03 Nov 2017 13:53:00 +0100 From: Arnd Bergmann To: Madalin Bucur Cc: Arnd Bergmann , "David S. Miller" , Jiri Pirko , Jamal Hadi Salim , Camelia Groza , yuan linyu , Claudiu Manoil , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] dpaa_eth: avoid uninitialized variable false-positive warning Date: Fri, 3 Nov 2017 13:52:24 +0100 Message-Id: <20171103125256.1829830-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:zaeOTpV4oUUOi9X3BT2yQi3YZHuKEtsR0Big8+3vzPzOxgin1i7 O2GAryIWA93ypbhlwb4OTV7i4KL0hAkkj4dlTuFdUDy9HKwO3Trvvl6UJxcuSXJq1ODHT/E 49jFSvmwfQlzthQnjWr5LqCwP9rTrLQ1QQucplUYJRZ+e9k4BxxsdRDo9dpiUpGBG7+7/lc 5tNwGcWzxQROyg5nOOUdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:kKPO+wBxoVk=:I9eh7G0yfcJ2Isr+kRCSby kwxFjSmUGLKo1/byL4NfvRR51PTOcdg/LBGqqB4ggZw0WEysPKDpGMn2aApwxkJpmDzYq17Bn m11Gze5xZCbiz2/pviEE/87OpZGqqBaWiCEK2vOOQi0g79ozoI+doxVXAH5DRqEkK4pxOyOag Bl3mBm0RTMf8idG5mFLhGeMj4lLYnVe0m0Ok8Tm2ThNNc0W4+Dk8TggLz6KWHtMpcX0L5ElfW bnMD1tFozmfiTkrClPef8bzysTUE1yOp9qf3Jeu0iPZ84PKZMWNudkM1jO5ZdZpKVfsQ3GoDV zYDEyWecqf2AX25O4JUwid+x6LfPH7TNSRO0t0PmzaK+Y2F+Ska5xVNSUCr7HCN23Q0cJfjXf aUnSegQ+irMy3rBXNuGRf6/zz8oNf4bQOLgl65ANKiWwNtOGaKYbrL22NEb5Jb/43JfxtkH2Z 8UIZBIOowmYz/wFt2J+nct8nMhinyX7z4VksJGRTEDz6VQUcDrqUG2qLl3Jzn2I9kStozrd8+ T4ynEGXcuq0kXcNA3mIGslR2XDHf0iIL0rKiTLaKO+vlWT+PvBdjI0d7EJTHuZMz9QcSWbss+ /7qpqHtLimeaR1ZkNEAnP+EETXg/JSRwRDS5VB0i9+Cruy8U+ibImXNG2ElZSuOVbGhlOzZud 074SG26EtnAyaOI3q+UGzpKalKC4pja4ILEjw3pOaFccJ86iGDiDEGUorABQf6MopHZwWjzN4 wbgAa2K0TghvREv/9eO19KMxbN6C118g5YDNTg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 969f6b12952e..ebc55b6a6349 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -1721,6 +1721,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, /* Iterate through the SGT entries and add data buffers to the skb */ sgt = vaddr + fd_off; + skb = NULL; for (i = 0; i < DPAA_SGT_MAX_ENTRIES; i++) { /* Extension bit is not supported */ 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, count_ptr = this_cpu_ptr(dpaa_bp->percpu_count); dma_unmap_single(dpaa_bp->dev, sg_addr, dpaa_bp->size, DMA_FROM_DEVICE); - if (i == 0) { + if (!skb) { sz = dpaa_bp->size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); skb = build_skb(sg_vaddr, sz);