From patchwork Wed Oct 19 12:09:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101656 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp214317qge; Wed, 19 Oct 2016 05:11:21 -0700 (PDT) X-Received: by 10.99.147.11 with SMTP id b11mr8955054pge.22.1476879081368; Wed, 19 Oct 2016 05:11:21 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 186si36849292pgi.84.2016.10.19.05.11.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 05:11:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bwphE-0002LX-Eb; Wed, 19 Oct 2016 12:10:12 +0000 Received: from mout.kundenserver.de ([217.72.192.74]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bwph9-0001rF-Fm for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2016 12:10:10 +0000 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M0ACi-1cooLe3cDc-00uFIY; Wed, 19 Oct 2016 14:09:31 +0200 From: Arnd Bergmann To: Vinod Koul Subject: [PATCH] dmaengine: st_fdma: fix uninitialized variable access Date: Wed, 19 Oct 2016 14:09:10 +0200 Message-Id: <20161019120927.3251235-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:5GFrfwKlyQ6SaK5vLDoaEZZbist3sPtodj1lfVK1namFgPW2q7U aCaGfwoU6K8gf+jXslo07XeQpe/eI41L3IFrJsPScIMJetzJ9jGU0dTjQFu4aOloExQII5U r4v0BX3z1Sa8bwnM09M5/yUKAoHNialvcxZNRuoXGXV1gnULrjPnhHmG8Ws9X0Ehu9kTaQN T+URT/csCaBxde7C4MLiA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZQsOaje8XgI=:1axd8436hltevo4+xmQNOI mFi0Zz+y5fKfnYO7OWki53E4S5wACUJ3iDnih1oTZ5gYdEf3FpGJVYVjKQpvKTWT3QXqCaHGl aKEDHeHOsIKX2NqH60lMHOoYkO5NJuLA3yuofO1QTTw9P/mKQwkZ2QEyFVD2kJ2aPZl7OqK3c XsDnFE3K/joVad+q8gvb7XMB3T/v1Gqyo8Sph74fNVK1UH8NqrBW3bk9vwvO6YsMO3d/HIhh5 KagxiNuiq7pMPjtYc1wct5v7YyiOKc/auFwandyRFeAklvymZxqX6XUZz5zrgbzwKI9WskiSC tVO6t1rIW8C1nsyVDMXiRTkXSZbVu0PEth0wnNb4RUUai/wDUdK7xwrdpiJI51tdKmMo3BCLz 1mrAzc+2ovD4IEWNn4S1DzMwKI/tPnGFpZZkLlAgpag2cncyVAS13GAp1C9Vg1bkTZn+rWJo7 24kJ0gMve8zQw30+kJhqWWFpUr+EQNX8ZAwPxojP5atYywKfXAoBvessbfHzls4l+cp0K9EzT nS+feTVofquyBaBYL8lMn5TcGMlme/jfPRBXzqknhYKT4cWV889YF6MzXqr8W8dCoQ1baINtc BbAAqgReVOIRKQYh7i5b5ADsPqUSZPJTzN/iQoT4P+7fRsJblorh5ikEuBrro7fKW+NtTVUWb 4OG8EE8wBxSMRcw4cXksOUmkSKbpXss3y6ARa7VIoph+WxgihSrtdLrgsvrDRB69tzWE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161019_051007_992110_817A2E4D X-CRM114-Status: GOOD ( 14.51 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.74 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [217.72.192.74 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@stlinux.com, Arnd Bergmann , Patrice Chotard , linux-kernel@vger.kernel.org, Peter Griffin , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, Dan Williams , Ludovic Barre MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The newly added st_fdma driver introduces a build warning for allmodconfig when we add '-Wmaybe-uninitialized': drivers/dma/st_fdma.c: In function 'st_fdma_probe': drivers/dma/st_fdma.c:777:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] The warning is correct, though this can't happen in practice as the check is redundant (we don't get to this function if the pointer is NULL). Even if the function were called with a NULL of_node, the check is not needed because of_property_read_u32 can deal with a NULL argument by returning an error. Removing the unnecessary code simplifies the function and avoids the condition that we get the warning for. Fixes: 6b4cd727eaf1 ("dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support") Signed-off-by: Arnd Bergmann --- drivers/dma/st_fdma.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.9.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 515e1d4c43e8..232d3547a6a3 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -720,21 +720,11 @@ static int st_fdma_parse_dt(struct platform_device *pdev, const struct st_fdma_driverdata *drvdata, struct st_fdma_dev *fdev) { - struct device_node *np = pdev->dev.of_node; - int ret; - - if (!np) - goto err; - - ret = of_property_read_u32(np, "dma-channels", &fdev->nr_channels); - if (ret) - goto err; - snprintf(fdev->fw_name, FW_NAME_SIZE, "fdma_%s_%d.elf", drvdata->name, drvdata->id); -err: - return ret; + return of_property_read_u32(pdev->dev.of_node, "dma-channels", + &fdev->nr_channels); } #define FDMA_DMA_BUSWIDTHS (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \