Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp493591pxx; Wed, 28 Oct 2020 09:34:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4BWT0bj+8Y13ZMpvTUcIi6m+Ngors0RyAjCYtyYFHD6csJzXoAY93UQ8VBb7YIOYlwtLx X-Received: by 2002:a17:906:cc50:: with SMTP id mm16mr8585341ejb.145.1603902862227; Wed, 28 Oct 2020 09:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603902862; cv=none; d=google.com; s=arc-20160816; b=JrYoFAimDvZZB/CXoS3LBVu3qaXuNfzTi+Zcn/bKpU7AG967w5sWgNAOO0h7X+Hn2u REP4osRhTzqClR8CDpMibGXlwYag728ELzyacbw+blRkGU6V43BN6v8jeGagmu0s+Sf4 s3fmhrGQZFQh8lDnQvbSPQKfmf/EmZOqZ644yUlGB/CPfqlucqQx88EuUpBaGreM+NBQ HDPIbHrbyi94t35Ny3HYwD8AAOlXTfu8Vwm70gpQSuATqOHk4y27s8vFw5g1LL7V1xNs ZvLAoRU5h0IsnUZ4XTvMOTGNDON0Lhsyn5XbrZF2Js5UO5zDWqo0yQikIDBv9VjeOHnT 99OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IY5BgWb61fq3HnXfxaPaBbW4qkGu6u145AyDBSJfs+A=; b=VOoDTKAqvoGidvod3QAX0JXLLaMEL/m4JKpsRm3u8e9SAq1+XXIsDZxkyakskrB7Xj +oBhuHUbu6hMKV0ocpKGomrlsKrGdAeKlbxIBdNSOAkx9O/POqcV3JoH2GyPQtIiW41u EssjbrVl9Ku/TsgTpqV4skQLZ4Ku9Zt4yWbAj27Y8uGHOvXsMwuBJZHUhrtKMtjylnji yv5jqcW9L0R5hh61Mir3wdknD/qwZ5S6z/fGJXDwdlUQ5H4RXZNhqt+QR4javn5ZYQNB 5nNs2Iry2uKxoSwnIhPQ0bEvxwXoNzZMGr7bRPphNklrhdyUeiDXLm1ctZb/mMFyKu7s 7Yfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AYHevJwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si3756365ejs.0.2020.10.28.09.33.59; Wed, 28 Oct 2020 09:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AYHevJwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1817211AbgJ0ROf (ORCPT + 99 others); Tue, 27 Oct 2020 13:14:35 -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