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: 910901 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ispras.ru Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mJWSQ9Fh"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40gzxF46NJz9s3q for ; Thu, 10 May 2018 00:57:53 +1000 (AEST) 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=Db8l3yBml2Bs8Mr0GqVDydkO3MsSuQrEhFylehwpvqc=; b=mJW SQ9FhwA/6qHAv+hTzZntArCHHtPCffmo0eHVDrL2+r8jEv0TuokJ87AqfC16FGuCcQRRXXrrfjqVj paWV56e8jL4Xna53zU59JFfAW9WzyK4kPGtJWjNL6WdoLBWMlm3Nlz2dV5RIHI3gaGjQ1sc3QjYv/ AVu01Hj0P0q1lAHixFmFKI70WNeq3w4vmcY31LBVB45uLLF+koqqiFIfb6bcGJ+8lmDdNuXcJCQD1 Jy49meQKFFHaCO7u8xURB2vUBP3u1McwoNMISm3XWPBZLZ6yz31KdwJaqEltuqWDyjJDW28ywBmEV Z4cRu1ApAQcIwaa3aeohsW0wO/ruHrw==; 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 1fGQXF-0001Nw-VG; Wed, 09 May 2018 14:57:42 +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-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [83.149.199.45 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list 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-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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: