Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5383699ybl; Tue, 14 Jan 2020 08:05:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxEJ5yFF5TNbVZaXTXwkMCzOeAzH3fFG3wa6Eaj/ZljcHYdLe+hXGlsd7U7cwvGQJuP3Gto X-Received: by 2002:aca:4309:: with SMTP id q9mr17503451oia.158.1579017941448; Tue, 14 Jan 2020 08:05:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579017941; cv=none; d=google.com; s=arc-20160816; b=QVphp7ZPsph+qz3/D9FPEY/mk7TdbOuzO3Afy1LwfsrTIJoXpCQ77MDWyV56g2+UrJ ZP40mW7F61x93pCfONxRL8xASfUrF6DccmBCdzGvTRY137fEfTyzDp88W8fPHgqcoe9m wgViUALMcRUS9WPc2g54tN9zpPgd9c8ryGicmd/omGy+5zuFXp4WkzejrLnNsqplMPbv dyOc9KuXX6C70GUJQx1Jqs84EKhEeZe0ulcHMyl0yMhEtlruIin9ohOWVKJKgMoe0GaY J2qA7Es8cyFUaQo0YL9zlyr8M7OO0zmMghxor4M1hFqU3OY1v7eMZQrrCVLVTqzPhs6Q 2v0g== 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:message-id :dkim-signature; bh=xN6Ppzc+LMdYKzWDRSnBwvud8ZwuGgv8OWrBjgrESDM=; b=W7BnfpBy81KjeSTQOXBUiIzSnclD7QaK45PwZj+2uBtVJCtrNw+ne+8xKm7lzLtc5p KfWZmrG5/I2TEEzmOkdk+U0k06loGVS+8Vd7AdRIyDTQGzTSKLAJqejgxcv67rMBG+wX TgA5389zLU/zso4ZepfXm83wNJ2wK+hJmtFa6kfAPGMQ3xo6my95Bb6Mbm/oFnryWXJk btov5YX3VQR1G0NDNzYQ9Y2HXb/MG3kZ1CWNl53H6GBQsmrbdOM5AiiHzky/W9x3DjiO 8T6Rc1LhCGm0EtE9Lvpn3CZGb9G8IEiRdLHNsUcDACSZ2Eq0cGPjn5dz3YhoB9gD00hi 8NoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=S+UxuITg; 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 q2si9036560oti.273.2020.01.14.08.05.27; Tue, 14 Jan 2020 08:05:41 -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=S+UxuITg; 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 S1728966AbgANQCn (ORCPT + 99 others); Tue, 14 Jan 2020 11:02:43 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:14061 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728879AbgANQCn (ORCPT ); Tue, 14 Jan 2020 11:02:43 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 47xwG81WBfz9txb0; Tue, 14 Jan 2020 17:02:40 +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=S+UxuITg; 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 HgM0nnBSpLFA; Tue, 14 Jan 2020 17:02:40 +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 47xwG80TLSz9txZy; Tue, 14 Jan 2020 17:02:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1579017760; bh=xN6Ppzc+LMdYKzWDRSnBwvud8ZwuGgv8OWrBjgrESDM=; h=From:Subject:To:Cc:Date:From; b=S+UxuITgoSpswC3s5breEl/xE6gr4caOs/HbwtLch+p5VEZn8GzhzsaBErtCt1hX3 qUXPik8yymwHIWSN4FxUjdVGUoP1K+AsYCo7/u95BIdeCQLIZIqLal4B1IMU18hGt9 LbuL4FPLuiL/eYmNtFXvpt48S6PCnqDM4OzpCwBg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8E11D8B7EC; Tue, 14 Jan 2020 17:02:41 +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 zw9swoOyGvDa; Tue, 14 Jan 2020 17:02:41 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4FE008B7E8; Tue, 14 Jan 2020 17:02:41 +0100 (CET) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id F152C6381B; Tue, 14 Jan 2020 16:02:40 +0000 (UTC) Message-Id: <2a4a7e11b37cfa0558d68f0d35e90d6da858b059.1579017697.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v3] 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, 14 Jan 2020 16:02:40 +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 --- v3: rebase on today's spi/for-next and using PTR_ERR_OR_ZERO() in one place. --- drivers/spi/spi-fsl-spi.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index fb4159ad6bf6..3b81772fea0d 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -706,8 +706,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) @@ -722,10 +722,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 /* @@ -744,24 +742,15 @@ 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 = platform_get_irq(ofdev, 0); - if (irq < 0) { - ret = irq; - goto err; - } + if (irq < 0) + return irq; master = fsl_spi_probe(dev, &mem, irq); - if (IS_ERR(master)) { - ret = PTR_ERR(master); - goto err; - } - - return 0; -err: - return ret; + return PTR_ERR_OR_ZERO(master); } static int of_fsl_spi_remove(struct platform_device *ofdev) -- 2.13.3