From patchwork Wed May 9 14:56:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 10389703 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 D981860170 for ; Wed, 9 May 2018 14:57:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7F6929053 for ; Wed, 9 May 2018 14:57:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC2D729059; Wed, 9 May 2018 14:57:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 2F03929053 for ; Wed, 9 May 2018 14:57:13 +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:In-Reply-To: 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: References:List-Owner; bh=iyaH9dOxwqRWUgN0kGK+nWY2TuTWseJkXVkt2Ntrnrs=; b=TZK jppHDd/VlyxmS1OKJK72xTxMzQVVL0ubhVJ0DU8F5fLd2FCpdcMTa8OqNJEOQRgEXJr4jKDRkc7Eh U1kvnG68rd649Cwg/GHo5V4a3SVKPgE7wf/uGQ4irhBZY90zMOVI+ew9jTmFWLPopUYbdlHD9LJ+R E5ZKJ6B+Ekksp0tPdMXjwHOEZvfjf7Tpx8dzMr1PkKoJhYBhcKsVxaQns1CYrgMG5p1PJX6t/mx3h lwUiqSY7bxzFMaWr9h2FkNSEl2Tp+nrpOhpiRfzEb/IJnt1gOKmCmvWjjfU1ddHpncc3RQRr7dq8Y 3U7pFnAdDjtpulwDYWaKBowLuEVi+5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGQWh-000199-NR; Wed, 09 May 2018 14:57:07 +0000 Received: from mail.ispras.ru ([83.149.199.45]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGQWe-00017s-Lr; Wed, 09 May 2018 14:57:06 +0000 Received: from hednb3.intra.ispras.ru (pluton2.ispras.ru [83.149.199.44]) by mail.ispras.ru (Postfix) with ESMTPSA id 9D25C5401D0; Wed, 9 May 2018 17:56:53 +0300 (MSK) From: Alexey Khoroshilov To: Joachim Eastwood , Brian Norris , Boris Brezillon Subject: [PATCH v2] mtd: nxp-spifi: release flash_np in nxp_spifi_probe() Date: Wed, 9 May 2018 17:56:46 +0300 Message-Id: <1525877806-21148-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20180509163920.67a5f203@bbrezillon> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180509_075704_910376_48299DC9 X-CRM114-Status: UNSURE ( 9.69 ) 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: ldv-project@linuxtesting.org, sil2review@lists.osadl.org, Richard Weinberger , linux-kernel@vger.kernel.org, Julia Lawall , linux-mtd@lists.infradead.org, Alexey Khoroshilov , 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 nxp_spifi_probe() increments refcnt of SPI flash device node by of_get_next_available_child() and leaves it undecremented on both successful and error paths. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/mtd/spi-nor/nxp-spifi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c index 15374216d4d9..7b047951d0a2 100644 --- a/drivers/mtd/spi-nor/nxp-spifi.c +++ b/drivers/mtd/spi-nor/nxp-spifi.c @@ -438,11 +438,15 @@ static int nxp_spifi_probe(struct platform_device *pdev) ret = nxp_spifi_setup_flash(spifi, flash_np); if (ret) { dev_err(&pdev->dev, "unable to setup flash chip\n"); - goto dis_clks; + goto put_np; } + of_node_put(flash_np); + return 0; +put_np: + of_node_put(flash_np); dis_clks: clk_disable_unprepare(spifi->clk_spifi); dis_clk_reg: