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: 9384571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B98660762 for ; Wed, 19 Oct 2016 15:41:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D68C27EED for ; Wed, 19 Oct 2016 15:41:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 725DA28C70; Wed, 19 Oct 2016 15:41:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C75D27EED for ; Wed, 19 Oct 2016 15:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S945362AbcJSPlG (ORCPT ); Wed, 19 Oct 2016 11:41:06 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:64269 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S943947AbcJSPDy (ORCPT ); Wed, 19 Oct 2016 11:03:54 -0400 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 Cc: Arnd Bergmann , Patrice Chotard , Dan Williams , Ludovic Barre , Peter Griffin , linux-arm-kernel@lists.infradead.org, kernel@stlinux.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org 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:7DHKeIF5H1g=:qy4CydIfZwmDvPBP+Dlp7v cRjXz5YJH/mJIsuKuqA2RpGsBSbD8yI5UEbRIrTXcACvXGsCqfvcw4V3T+H9mC0sg0a17Ek0x xFG42ZKWaW3Z40N4NuDrjmzfRTmYnndDNuseIPAp0YWNS1uuPQndrwGxjP43Uk4JGGmnXwKkH Z3V4YByyj/ybFn9wWsK2mSVRbry11b3IQm8FvoCT+AGJxYCOERxk/jU18N8mhqcsyfQ5ht65P /hOJhniONqC7wx1FAiytq2kCUyAHPvzJ5dEx0kEQZTkqDXmBDdlzTrLoi8XuwBvFFWCTxMruE 2T5zYh09TzhwRUZ5P8KrXzkUeyWzsh0qd6PRIhdQ5BuzG7MZ9yRxdDL2bGVdXGQJbSA0kpaOK w8Hd3KnbJ9av7+orEy+7BxsrVA6/zsNoEFikoj4NWwhy/3GLDU4FuV07iga0aSUyMuT//8ac+ PttUiTjuHx9Ge9bw4qfSDELVkHh9sFoTnt7qH7RHIn8vUb+TEWZfjhEd+Y4+P8rzNHexJQW3u N9m/X5w4kd2RKI+llOigjRWsCkCKwo0EMAyMJi+oG5tZ6kdMZVSUCiLH+nTVTPc3zfbgIMjr3 LVbukbH2z08CBGwow3XUlL/zp4BeEms0MDPTPdZN1uhDs7CC6pVg92fyVvXOl/1nepYs5gviY cHm9NNFv8LubJ+/tnCejTBXchG7yxfR0z8mWIkC2kS80CETiKcwi1jUJpP6n07OqWWh4= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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) | \