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=-12.8 required=3.0 tests=BAYES_00,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=unavailable 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 8481DC388F9 for ; Tue, 27 Oct 2020 17:14:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 373CA20809 for ; Tue, 27 Oct 2020 17:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818878; bh=BNu0jh3EbP6s15C2IyS+cuTmVxdex4iDTXQGZGZUJUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ctkq9TXaMta+DjLFXz0tl8e1PKzz6VEAj9Gf6SBKJP6Ddqy7rjfrJD/evG+GXriVg HUG+G1Y+CDy3mQb/lH57GcS9NegGjlrUW8QtFWRKeZ5Sfc/30TuDkoTQNsnbUzNRVL oTANZ2CsnGvwRG9dn6vAcF92nz1TEc3J+nY5y0QI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1817215AbgJ0ROg (ORCPT ); Tue, 27 Oct 2020 13:14:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:59960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1773105AbgJ0O6e (ORCPT ); Tue, 27 Oct 2020 10:58:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 3374C20714; Tue, 27 Oct 2020 14:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810713; bh=BNu0jh3EbP6s15C2IyS+cuTmVxdex4iDTXQGZGZUJUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AYHevJwrEI8YRCHUe8w/t0uludCJsgDuT5FynhjOO4PVfLo2Hu3nd9sG/EMo6u7ad zWmFAjUN0Bv0ObSql+m5cIC0ELufbv0GSQAH/y0cjUqM954ho1mL7+npHOGorzRs+2 D2NhlB9gWOtloCSKy5HzYLSaGN1N0yBqq00bKAOY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vadym Kochan , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.8 237/633] nvmem: core: fix missing of_node_put() in of_nvmem_device_get() Date: Tue, 27 Oct 2020 14:49:40 +0100 Message-Id: <20201027135533.797327527@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadym Kochan [ Upstream commit b1c194dcdb1425fa59eec61ab927cfff33096149 ] of_parse_phandle() returns device_node with incremented ref count which needs to be decremented by of_node_put() when device_node is not used. Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.") Signed-off-by: Vadym Kochan Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20200917134437.16637-5-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 927eb5f6003f0..394e75dede725 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -823,6 +823,7 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id) { struct device_node *nvmem_np; + struct nvmem_device *nvmem; int index = 0; if (id) @@ -832,7 +833,9 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id) if (!nvmem_np) return ERR_PTR(-ENOENT); - return __nvmem_device_get(nvmem_np, device_match_of_node); + nvmem = __nvmem_device_get(nvmem_np, device_match_of_node); + of_node_put(nvmem_np); + return nvmem; } EXPORT_SYMBOL_GPL(of_nvmem_device_get); #endif -- 2.25.1