From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EB98C433DF for ; Tue, 23 Jun 2020 21:30:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFF4620707 for ; Tue, 23 Jun 2020 21:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592947824; bh=bD+I7ZFfP4wnV/brtaJCwqwEgn+sv5ZM40m+er/hkpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sZ1q66ssU2+p/YI3fPi3sw6LXjn2I802Ha03QBs9xyXF7wMlFp2XKKtxWtRxpicSB dE8V60PkITBw733DmR/I8pMC0BIAbUpCc8UWAdTeDkvtTghgc8QDbjWkmBQJeMoMbE ip9i75yjZkt54sraMzq3CGJ4LalwVOFJ382NLiPc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390107AbgFWVaW (ORCPT ); Tue, 23 Jun 2020 17:30:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:56364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389147AbgFWUOD (ORCPT ); Tue, 23 Jun 2020 16:14:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BA6B206C3; Tue, 23 Jun 2020 20:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943242; bh=bD+I7ZFfP4wnV/brtaJCwqwEgn+sv5ZM40m+er/hkpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ow1elfeqLK1UBT6QIXpJtpwctA911qTHuP+qv0u3zpuEK2Wd3VSb1oDAAzqew3Lb qDhxyQjbhZCU89+DcRkIP/nb+SMAOBsum77dgJWidzcRt49GxgbsleX/G88H5qgcPu 6Ptss0debPkCaoysciWFnqs5UpAj3CcitskUuyN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, yu kuai , Linus Walleij , Sasha Levin Subject: [PATCH 5.7 316/477] pinctrl: sirf: add missing put_device() call in sirfsoc_gpio_probe() Date: Tue, 23 Jun 2020 21:55:13 +0200 Message-Id: <20200623195422.467029626@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195407.572062007@linuxfoundation.org> References: <20200623195407.572062007@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: yu kuai [ Upstream commit 66339f2fba3fa05b0507e1887e4c6abcfc6228a3 ] A coccicheck run provided information like the following: drivers/pinctrl/sirf/pinctrl-sirf.c:798:2-8: ERROR: missing put_device; call of_find_device_by_node on line 792, but without a corresponding object release within this function. Generated by: scripts/coccinelle/free/put_device.cocci Thus add a jump target to fix the exception handling for this function implementation. Fixes: 5130216265f6 ("PINCTRL: SiRF: add GPIO and GPIO irq support in CSR SiRFprimaII") Signed-off-by: yu kuai Link: https://lore.kernel.org/r/20200603013532.755220-1-yukuai3@huawei.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/sirf/pinctrl-sirf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c index 1ebcb957c6541..63a287d5795f0 100644 --- a/drivers/pinctrl/sirf/pinctrl-sirf.c +++ b/drivers/pinctrl/sirf/pinctrl-sirf.c @@ -794,13 +794,17 @@ static int sirfsoc_gpio_probe(struct device_node *np) return -ENODEV; sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL); - if (!sgpio) - return -ENOMEM; + if (!sgpio) { + err = -ENOMEM; + goto out_put_device; + } spin_lock_init(&sgpio->lock); regs = of_iomap(np, 0); - if (!regs) - return -ENOMEM; + if (!regs) { + err = -ENOMEM; + goto out_put_device; + } sgpio->chip.gc.request = sirfsoc_gpio_request; sgpio->chip.gc.free = sirfsoc_gpio_free; @@ -824,8 +828,10 @@ static int sirfsoc_gpio_probe(struct device_node *np) girq->parents = devm_kcalloc(&pdev->dev, SIRFSOC_GPIO_NO_OF_BANKS, sizeof(*girq->parents), GFP_KERNEL); - if (!girq->parents) - return -ENOMEM; + if (!girq->parents) { + err = -ENOMEM; + goto out_put_device; + } for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { bank = &sgpio->sgpio_bank[i]; spin_lock_init(&bank->lock); @@ -868,6 +874,8 @@ out_no_range: gpiochip_remove(&sgpio->chip.gc); out: iounmap(regs); +out_put_device: + put_device(&pdev->dev); return err; } -- 2.25.1