From patchwork Thu Feb 25 11:37:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102687 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp109880lbc; Thu, 25 Feb 2016 03:38:20 -0800 (PST) X-Received: by 10.66.142.168 with SMTP id rx8mr62543113pab.14.1456400300874; Thu, 25 Feb 2016 03:38:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 79si12064853pfm.61.2016.02.25.03.38.20; Thu, 25 Feb 2016 03:38:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-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-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbcBYLiT (ORCPT + 1 other); Thu, 25 Feb 2016 06:38:19 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:59349 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752104AbcBYLiS (ORCPT ); Thu, 25 Feb 2016 06:38:18 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lgc4H-1aBvEk3ho5-00nwnY; Thu, 25 Feb 2016 12:37:48 +0100 From: Arnd Bergmann To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, Rob Herring , Sergei Ianovich , Arnd Bergmann , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: lp-8841: return correct error code from probe Date: Thu, 25 Feb 2016 12:37:40 +0100 Message-Id: <1456400265-3068525-1-git-send-email-arnd@arndb.de> X-M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precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The spi_lp8841_rtc_probe() function misses an initialization of the return code when it fails to get its memory resource, as gcc notices: drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code to propagate the error from devm_ioremap_resource(). Signed-off-by: Arnd Bergmann Fixes: 7ecbfff6711f ("spi: master driver to enable RTC on ICPDAS LP-8841") --- drivers/spi/spi-lp8841-rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c index 44bb69c3f1d6..faa577d282c0 100644 --- a/drivers/spi/spi-lp8841-rtc.c +++ b/drivers/spi/spi-lp8841-rtc.c @@ -217,8 +217,9 @@ spi_lp8841_rtc_probe(struct platform_device *pdev) data = spi_master_get_devdata(master); iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - data->iomem = devm_ioremap_resource(&pdev->dev, iomem); - if (IS_ERR(data->iomem)) { + data->iomem = devm_ioremap_resource(&pdev->dev, iomem); + ret = PTR_ERR_OR_ZERO(data->iomem); + if (ret) { dev_err(&pdev->dev, "failed to get IO address\n"); goto err_put_master; }