Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5516072ybl; Tue, 10 Dec 2019 07:18:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyi7rZ8HBPzTgfu6zFl1OS8ZCWDQnNOs2qpYgdkMhZ594dfAp0bu9haxOMZoI7JQglg0vS0 X-Received: by 2002:a05:6808:b13:: with SMTP id s19mr4085664oij.119.1575991097418; Tue, 10 Dec 2019 07:18:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575991097; cv=none; d=google.com; s=arc-20160816; b=W8CyCs5h1MjF9thO6QHZ6Zi26Lr1qUmOd6pDR2GAh+cU3iA+3nFdp/fA/7vZBg+YeI 7tNEy3gcF7k4eoPzrmYanvYwh80FZT3KUbcekvrUkZWCmaoqQ3vW95+6VMQrenttIN9e TqVtA4v8uis1hcWVuaaktdMMOR1B+udY+2KLd0F3kg5hkRk9cAYlO5WEuxa1xpN3TWvI nFGnticIqY1YEQJlCdeTMTgMaH41pH3KzlWYqK2UhDrsSt0RyEm0MDrJX0J5QupaWbsp 2vOBytmaUoG3G59Kx4f7/bWdgetm9vQ4OxTC8Eh/frGT5CZAeh5UI4Mm3SDUj3qa34d6 SSIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=p/RN9wGhuytc2JKpwnOpBoY/ljEFeRGohPJvKHyg07M=; b=PA0y0kUUKb0hELuqH90k3OBNNG2Pe1H7BDl75cQGcgG4Cn1JWAumXQwWpwS22lXvse TZzqDaf2Q/RXudQ3J/OYGrmWhc2BdX/s64+88hOIdpxdvQq5L/pVCPliCIpQbuJFGpe4 uNThxN9XRe52KeU7j1d0xlY6Tb5CZ7Whm8EMaR4m1KH5nFgUoAxDzJZzfyNa/PJbphti FcHzUatKoIP5xDjojIAqO1C/U2gy+6tDyZXCwDNJtGmN9J+fkn7RzZ9p0cArwCEA077e Bhv+Dkb19Q1bg1E5bj7BIfFz9hLRv/Uoi6ig9FpsqXDa2oP3HQcUFpSuwUPz+eNx5ouG ejaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=pQG2hmmL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si1883556otc.115.2019.12.10.07.18.02; Tue, 10 Dec 2019 07:18:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=pQG2hmmL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbfLJPRW (ORCPT + 99 others); Tue, 10 Dec 2019 10:17:22 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:48955 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727448AbfLJPRU (ORCPT ); Tue, 10 Dec 2019 10:17:20 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47XNvw6cFPz9txNy; Tue, 10 Dec 2019 16:17:16 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=pQG2hmmL; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id evbLJu89xxoe; Tue, 10 Dec 2019 16:17:16 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47XNvw5b4hz9txNq; Tue, 10 Dec 2019 16:17:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1575991036; bh=p/RN9wGhuytc2JKpwnOpBoY/ljEFeRGohPJvKHyg07M=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=pQG2hmmLGeKr7afIsn4MGxkLUDeBbXB1/yLQk52nFJ10g1ixc+1FJjhWLuFU1AacW GJvPXJ0hzT1xkLqhsG5mo4n8iuNqzozvY0L2DG8qQ381DuFZf1dzwWhLXEQtjS69jq I66FNHT+JNDI99vBfZYE3lar3AR/FJKd1HIOHmSM= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4F5BA8B754; Tue, 10 Dec 2019 16:17:18 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id MuGuyZPvd_AU; Tue, 10 Dec 2019 16:17:18 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 819338B819; Tue, 10 Dec 2019 16:17:17 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id F13FF6373D; Tue, 10 Dec 2019 15:17:16 +0000 (UTC) Message-Id: <539a3b82463f64e8055f166c915f0e90f752c7b0.1575990944.git.christophe.leroy@c-s.fr> In-Reply-To: <1cdd0a26d7e1545f32c8bc4dc7458ebecdd6aaed.1575990944.git.christophe.leroy@c-s.fr> References: <1cdd0a26d7e1545f32c8bc4dc7458ebecdd6aaed.1575990944.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 2/2] spi: fsl: simplify error path in of_fsl_spi_probe() To: Mark Brown Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, kbuild test robot , Geert Uytterhoeven Date: Tue, 10 Dec 2019 15:17:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to 'goto err;' for just doing a return. return directly from where the error happens. Signed-off-by: Christophe Leroy --- drivers/spi/spi-fsl-spi.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 2d85c81983b1..e991c6ff4e7a 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -725,8 +725,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) struct device_node *np = ofdev->dev.of_node; struct spi_master *master; struct resource mem; - int irq = 0, type; - int ret = -ENOMEM; + int irq, type; + int ret; ret = of_mpc8xxx_spi_probe(ofdev); if (ret) @@ -741,10 +741,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) if (spisel_boot) { pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); - if (!pinfo->immr_spi_cs) { - ret = -ENOMEM; - goto err; - } + if (!pinfo->immr_spi_cs) + return -ENOMEM; } #endif /* @@ -763,24 +761,17 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ret = of_address_to_resource(np, 0, &mem); if (ret) - goto err; + return ret; irq = of_irq_to_resource(np, 0, NULL); - if (irq <= 0) { - ret = -EINVAL; - goto err; - } + if (irq <= 0) + return -EINVAL; master = fsl_spi_probe(dev, &mem, irq); - if (IS_ERR(master)) { - ret = PTR_ERR(master); - goto err; - } + if (IS_ERR(master)) + return PTR_ERR(master); return 0; - -err: - return ret; } static int of_fsl_spi_remove(struct platform_device *ofdev) -- 2.13.3