From patchwork Sat Jan 26 16:38:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Tull X-Patchwork-Id: 10782517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5F6B13BF for ; Sat, 26 Jan 2019 16:38:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B55A229E46 for ; Sat, 26 Jan 2019 16:38:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3FAA2A40E; Sat, 26 Jan 2019 16:38:34 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40FB929E46 for ; Sat, 26 Jan 2019 16:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbfAZQie (ORCPT ); Sat, 26 Jan 2019 11:38:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:40392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfAZQid (ORCPT ); Sat, 26 Jan 2019 11:38:33 -0500 Received: from localhost.localdomain (cpe-70-115-146-104.austin.res.rr.com [70.115.146.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CB0A2184B; Sat, 26 Jan 2019 16:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548520713; bh=JFNL5cRsIxbE1lyuBEhu+ozQ1a4Gcu8r207FGpnfE6s=; h=From:To:Cc:Subject:Date:From; b=K3QsQ/7Jy4ZvSAKXCt8VkhgecH2NIKDmciSnSfFoWWz4zbnY2tzXBlzPWXfXdb0/Z I/bZnHm4ws1FroFuplUU54Xdhtn4cM8i9dc1jc6//keGq0v+npsHu83XErflU7V07+ vjHURV5QimMrvlaCmb6AdI1fZmJZxO+xqF3D00e8= From: Alan Tull To: Greg Kroah-Hartman Cc: Moritz Fischer , Dinh Nguyen , Alan Tull , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH] fpga: stratix10-soc: fix wrong of_node_put() in init function Date: Sat, 26 Jan 2019 10:38:29 -0600 Message-Id: <20190126163829.4998-1-atull@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-fpga-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolas Saenz Julienne After finding a "firmware" dt node stratix10 tries to match it's compatible string with it. To do so it's calling of_find_matching_node() which already takes care of decreasing the refcount on the "firmware" node. We are then incorrectly decreasing the refcount on that node again. This patch removes the unwarranted call to of_node_put(). Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver") Signed-off-by: Nicolas Saenz Julienne Acked-by: Alan Tull Acked-by: Moritz Fischer [atull: remove unnecessary braces] --- drivers/fpga/stratix10-soc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index a1a09e04fab8..13851b3d1c56 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c @@ -508,14 +508,11 @@ static int __init s10_init(void) return -ENODEV; np = of_find_matching_node(fw_np, s10_of_match); - if (!np) { - of_node_put(fw_np); + if (!np) return -ENODEV; - } of_node_put(np); ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); - of_node_put(fw_np); if (ret) return ret;