Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S945508AbcJSPlI (ORCPT ); Wed, 19 Oct 2016 11:41:08 -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 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1752 Lines: 51 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) | \ -- 2.9.0