From patchwork Mon Nov 7 18:17:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 9415723 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 C12CF6022E for ; Mon, 7 Nov 2016 18:23:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA8EF28A4B for ; Mon, 7 Nov 2016 18:23:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF38D28C71; Mon, 7 Nov 2016 18:23:12 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B5CA28A4B for ; Mon, 7 Nov 2016 18:23:12 +0000 (UTC) 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 1c3oY5-00034W-VE; Mon, 07 Nov 2016 18:21:37 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3oVH-0008BA-Ri for linux-arm-kernel@bombadil.infradead.org; Mon, 07 Nov 2016 18:18:43 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3oVF-0006wv-Le for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2016 18:18:42 +0000 Received: by mail-wm0-x229.google.com with SMTP id f82so135377777wmf.1 for ; Mon, 07 Nov 2016 10:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o6p7nFWxk1VR7fZps40ridXXiUQ3COP/xshTPRMyp1A=; b=jtZ9VewjakDnc6sSNSEHs2TATcQGIbAn2v4EB3XJU9KCYxZ/Fl5CQhwAdaVp28XRLO ulu0rTrMWZQxRn26Asc8zBRQ+k6yKxfEkHvm7IFMwt1ZWiu1+yMvBwkuM5NJ/it00csw o80xjgWQOz3LoxW7GFuXuVd6UKcKcMtbNU+hc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o6p7nFWxk1VR7fZps40ridXXiUQ3COP/xshTPRMyp1A=; b=lvGmc28dkRLHe8l1n2WuHLnCRDWlS1FGVOKwJeHgKEADtMH1gkOlSZhksc0HSShxGy 6dsAVX2vphNfsK39LqeBbSN+F2A5NNrahB8QFrK3OqBFEAfzrGLBHaJjxww8ulyqt4Li YiaoKP/YtCoxHNZHgGrE4FJggEC469x8SI+mJlGDtNEpdOaF6fWr+T0a75QURh8CibU0 MbcQmFGBJ3NPM+31OWgnT+1DmOx1AfYhUmDNiel5M6VoqvXgu8UHY/QDRgaLlZsd7pc5 ImQz5k3S+YflzFSIm+epabjThZTu/NIu4x/LWyxYVuIeKAKPRq4LjaggfwqXG9OZ1HSx Vtsg== X-Gm-Message-State: ABUngvc2krnX7DQniIMNp+Wa4knSaHMVsea2GSHgmroM3yJopujTgrD6Su15U/RtETMPNBdx X-Received: by 10.194.115.135 with SMTP id jo7mr6658804wjb.21.1478542699600; Mon, 07 Nov 2016 10:18:19 -0800 (PST) Received: from localhost.localdomain (cpc89244-aztw30-2-0-cust4998.18-1.cable.virginm.net. [86.31.179.135]) by smtp.gmail.com with ESMTPSA id c4sm14921903wmh.4.2016.11.07.10.18.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Nov 2016 10:18:18 -0800 (PST) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, bjorn.andersson@linaro.org, vinod.koul@intel.com, ohad@wizery.com Subject: [PATCH v11 12/14] dmaengine: st_fdma: fix uninitialized variable access Date: Mon, 7 Nov 2016 18:17:43 +0000 Message-Id: <1478542665-17089-13-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478542665-17089-1-git-send-email-peter.griffin@linaro.org> References: <1478542665-17089-1-git-send-email-peter.griffin@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_131841_843877_B86A705C X-CRM114-Status: GOOD ( 14.76 ) 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: peter.griffin@linaro.org, dmaengine@vger.kernel.org, lee.jones@linaro.org, remoteproc@vger.kernel.org, Arnd Bergmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arnd Bergmann 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 Acked-by: Peter Griffin --- 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 515e1d4..232d354 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) | \