From patchwork Wed Aug 9 22:51:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9892413 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 0067160384 for ; Wed, 9 Aug 2017 22:52:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E67A428A48 for ; Wed, 9 Aug 2017 22:52:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D954F28A85; Wed, 9 Aug 2017 22:52:57 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F147A28AAB for ; Wed, 9 Aug 2017 22:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=6URPbcIxpkEG49EM5l4qNKvvqjCKRTXW+v5NaB7VyoQ=; b=SSA SgU6LzwPnhK6ofq2M0FuudWUqbCOvtg5e3PulXXWTmk0NlLfFHJ1onjrCkp//gEI3BpzgnLAERgGb nMJlnNBNnRhG3LqtD6owRJ7t5PsAF48HQu1ELbOW2oNS6jnkI4DJ+hxt7333KkMXYdZ1DhQr2GP10 bWAUWosyVo//TZ0DrLPLY4bBteEKnoqSng3ORQofIUfAtNFr0b0YQfdRIRCTCmjy40VoND1sE5mBL ULiw1JxycquFLQ3KskHY7OlKBu4zCqoRWwO/RDiDomc/Dofyy8187Q4dW5TUJLKf6K9uNEOdB8cAo iA1sB21Ifqkpctg5O3XUiWHZzbQycGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfZqO-0007Zr-Ki; Wed, 09 Aug 2017 22:52:52 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dfZqK-0007ZC-T6 for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2017 22:52:50 +0000 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-07.nifty.com with ESMTP id v79Mpewn016783; Thu, 10 Aug 2017 07:51:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v79Mpewn016783 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1502319101; bh=AMrdGMOfsA3ltiHavKANoUJIe+rOwOuQeYljtv0Hzzk=; h=From:To:Cc:Subject:Date:From; b=ROxGBYpsDMqFQwXA+Z2qUnOXCVxZyg5p1DnXK+wkQkS18P0vo/nLA6L7UsYsD9oLF zoe3iGH0gXqFKjyOKVgCNdSQJ2Tntgb+ppIG3DMiSJPILkDA0UzVIeohEp/QaGszVt IGDyAXvyJrDcFHf8zyPH6/7IXFZWUhbm8y8GjMdlSURwdQOP6XK8lwEJouAfGj8hT4 zNfwI/YP5oaanLY3WZ4c+4RobEP4Wz66rr/cxbJXkPjDR3vrNaUGaskOK2bz85HHk0 3+aPf2uagMqg8WiXLFCPJkOp9QnvVdkSYDJMF25LA1ZPWhlZJMV6lJSML/X0SbBYNp POAeU+1QPPOiw== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: linux-gpio@vger.kernel.org Subject: [PATCH] gpio: brcmstb: check return value of gpiochip_irqchip_add() Date: Thu, 10 Aug 2017 07:51:27 +0900 Message-Id: <1502319087-23396-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170809_155249_336586_E99FAF9E X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Linus Walleij , linux-kernel@vger.kernel.org, Masahiro Yamada , bcm-kernel-feedback-list@broadcom.com, Gregory Fong , Brian Norris , linux-arm-kernel@lists.infradead.org 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 Because gpiochip_irqchip_add() may fail, its return value should be checked. Signed-off-by: Masahiro Yamada Acked-by: Gregory Fong --- drivers/gpio/gpio-brcmstb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index e6489143721a..51485997f680 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -339,6 +339,7 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, struct brcmstb_gpio_priv *priv = bank->parent_priv; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + int err; bank->irq_chip.name = dev_name(dev); bank->irq_chip.irq_mask = brcmstb_gpio_irq_mask; @@ -355,8 +356,6 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, dev_warn(dev, "Couldn't get wake IRQ - GPIOs will not be able to wake from sleep"); } else { - int err; - /* * Set wakeup capability before requesting wakeup * interrupt, so we can process boot-time "wakeups" @@ -383,8 +382,10 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev, if (priv->can_wake) bank->irq_chip.irq_set_wake = brcmstb_gpio_irq_set_wake; - gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0, - handle_simple_irq, IRQ_TYPE_NONE); + err = gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0, + handle_simple_irq, IRQ_TYPE_NONE); + if (err) + return err; gpiochip_set_chained_irqchip(&bank->gc, &bank->irq_chip, priv->parent_irq, brcmstb_gpio_irq_handler);