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: 8423001 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2942A9F52D for ; Thu, 25 Feb 2016 11:38:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5908A20263 for ; Thu, 25 Feb 2016 11:38:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 856D820265 for ; Thu, 25 Feb 2016 11:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbcBYLiT (ORCPT ); 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-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:yRp6rWffd7sTHwAx9KNvzAZCp0qFEhOjeFpuMdWCjcWlPlIIOmv bJHR1+k54e6o6jyWIQC+vt+3ZEcUGj2b8sRL9I7xgIEMumAebM7RZTrlqf4rEDkXdDJ56pP JQvabpz2WvyWfci4EWfrC3zdXc/PfOWHoPBphQE4jqreyycUItQ/rOlt7zQAKtQe/0mQhs4 onzWNvSD9dwtbHSVhIaNA== X-UI-Out-Filterresults: notjunk:1; V01:K0:yKx9/P+lL9k=:mo65mbFg44Ijmu9C5dVqig XnpTFZA/BY3Rp+nYauWkaL9gmBT9Z6Q5uspXfJSoQeYsFfM9k6opiIQ6fkBIx7w4KvLmot6Pc BsMHG6vs+PE8D64nKCbLOcGlu7VBZHlpc8Fp3qfFpj4E3DFSHUxABc7JAOqeh9yW+9IhJuKXW zJgILG0sxmIlmUUGkK+c/SwaHCevH5EMPrI/ntETUMjbNp8DqCC6038ixbp5kvxYWj46YIsrz AEhJzjb3AdUQsluZOp0bfONJ5J4DrCw0ywbyQ3c3RJ6mV/sna+9R3+rKNYPDb/TEBvnBTbqr1 Kjw9N8JO8ZOkQKeRbMfnTBmaC2/GAKBYoAdvOtuSflj+YRPSCTvqWesQeCvy52vjOdiWOQsnj hhiCq2npMNA9kxZPe0EIpNnuaqlPHplP5PpwmiMdIo8j9b3w9BBXwWv6/ud80Zr0XSLA00etX IgQzM9OwrTXZjTHSIU6d86LdvdXchrNR0xMp/UrqrFU2Q42EA5IhW5/so/rKT0gRyEFI57BIm Tvt/0CZI6EUkmiN6oSo+EuvkiNqdvl1AV8f9AvjLKyDlZOWNW0wXX4xIwCe+vzZgxa5WaLzo1 3IixphFg/kRqrMeS5XaCo6Hy2+AMD0HpzhnYdlPu7Nffmffp9rof1VXbagyXBmrUV/jGGKWAS e2sqgj63qwO9P5EWl/bqvFc6RBM8ZwGAttdQJvI5KGL9Bga33feulx6Tqw08LNErPCB4= Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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") Tested-by: Sergei Ianovich --- drivers/spi/spi-lp8841-rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; }