Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2392730lqp; Sun, 24 Mar 2024 17:27:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbq+lK46g265tEV0X+EbP77OavDwhR/Q/VXDy7ztcBFbI4K268MKiwCEI/UrfexIrG/hLmk4wI/zr8pe9FIhJKzYliy+l6S/oNLY4R/g== X-Google-Smtp-Source: AGHT+IGwqblc/ZbjN8uocRL826iWRdwO1LG5NxRs7fmTMcbMUV5xPfP6rdpUamJQScwVTXebKktI X-Received: by 2002:a17:903:24b:b0:1e0:384:ecb9 with SMTP id j11-20020a170903024b00b001e00384ecb9mr7104229plh.8.1711326467532; Sun, 24 Mar 2024 17:27:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711326467; cv=pass; d=google.com; s=arc-20160816; b=Vu/EjsZUVRME0DadKEvQkwj6k9RUjBVbhO0ff5lUEAjl9S2tULvtvA1PZhc1KXYiUM UjEgmPFmY5ippEezZZty2kBoqz5R+BF1KthqnMCfLfwHUPblfFgJFrd0lggYcQo8opf3 7Nf5aExYKwQOG2Q7t+vIPECa8JtObpmuBeoH+P7fAsNchBW0SFpRW/Q2IbrHLXKF0twu WlYS8bD36+6ANhuGnpH4COP0PWxcFpxQOTpBJ7+xnAscFKCxDrreK1tFraLkeKPew+cA y4EzwEYgCmECpN8RS3qc7FWqmdth1V7beBewlb2t5C8wJRlQcDluoj6d4E6d6OIUgjlH 4IXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3hg802SNr7F8mRk71pGCohN4cTLhfnGlPGSubcmWMMs=; fh=KXyW26nOJVhyZBrBMcColsGz6kKR7G/JY7sJfcY1W2A=; b=M9PXHU0kW5IVnboi/3VM5JSTgUqQJqY9oIJLVp6Db0jYk6SRdxguTGwtAOK+pBNF17 kUUM+fTERjwWWvvzrv194eCs1o865noHS/pVQIdZCnX8Q+Xzak9hGA2Q2TOKeH3tfPcj o/Fjqa0cyh7UDqlPI4ZnfoG9yQ+6GKciFnajuKN66rAt5Rr7Oiup8YINrPbuc8OMHLoV 8oQTMPT7eETaPkVS7Rn1L8/ognlW/c4s2BSnmbHJa1dbK3ykAo0+Q/ysAXoiKwsIwYeR iU/Hmc16uyEUWUh91i0rVyKwFagsqbkS0+B94kEtQfOR/PY0RizoOvLiLO3ecxh2byeD 1BhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LUdMZDtm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x4-20020a1709028ec400b001dffdf223e5si3985480plo.407.2024.03.24.17.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:27:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LUdMZDtm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7CFFDB2425D for ; Mon, 25 Mar 2024 00:16:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DF8419AC0D; Sun, 24 Mar 2024 22:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LUdMZDtm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB8E419ABF1; Sun, 24 Mar 2024 22:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320154; cv=none; b=Zrmqz2Ewbc0lnKJpzcNVZaDtKfuQWEIMDl+gENEVC++ymUTlmh0lDsuIE6MpXG5H1NDjSmb/FCxNzVMPttjfF+LL8wAiMyXIEGi+fE8PJHa4PqTTpPB4E+0YiYiX+e4sz+BWs2vkNA2bP+YOTcRl6z28JD5rbSVA06sTJVGZIDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320154; c=relaxed/simple; bh=IHQKUG65SlounuAeFf6b0YURdCZEgBFW9Po4H7Hhhfs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FWSlO5ktMNA2LM2ZoYhD+rdCHMpoGrQLBOM3NCQ5CKI6TFqT+GH5u6VUkQA3eyRFJ8IeJBmTcr6PnARNcxt+otqg7g39pnMgZr2g66XcX4ZifKpv2CFD2ZFVSPO7jTrO8tKuOtlQvnJTEQRJceJO9aG06iZnuLCgVw0x3nYHBNw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LUdMZDtm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3CBEC433A6; Sun, 24 Mar 2024 22:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320154; bh=IHQKUG65SlounuAeFf6b0YURdCZEgBFW9Po4H7Hhhfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUdMZDtmAQPH4qmrmax9kJXMnDBJOs2dBVstZY35OMHQox9RjX2Or+QlfT8sbzWuy tVXUhG23y74LEZDDIF8DA2S5giygtWkrk/84i0tTB8m2wOf5mMlfCl5sDjNVJtL/jm 8/mAQJmBmxGAl8By9HxAUSKU/Sl194wmNkTUFk035CFzPUfo6jketY1RK6pttttLeM gHcta4azdCnjBamRZLACrHbKMl8Ql8ZvxTkPpB7u+TN3fLjBy7SlFFOA/55HO4d+Zq sEuSQ1rxkHT12BVLeGRSrthu6hSKBeUhR62u+SZGD/OWuKpEE03BwQ8oA5lV4H/zpL hS4j+AnOBh6Rg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Griffin , Lee Jones , Sasha Levin Subject: [PATCH 6.8 463/715] mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref Date: Sun, 24 Mar 2024 18:30:42 -0400 Message-ID: <20240324223455.1342824-464-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Peter Griffin [ Upstream commit e28c28a34ee9fa2ea671a20e5e7064e6220d55e7 ] of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node. Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager") Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20240220115012.471689-4-peter.griffin@linaro.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/altera-sysmgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index 0e52bd2ebd74b..fb5f988e61f37 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c @@ -109,7 +109,9 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, dev = driver_find_device_by_of_node(&altr_sysmgr_driver.driver, (void *)sysmgr_np); - of_node_put(sysmgr_np); + if (property) + of_node_put(sysmgr_np); + if (!dev) return ERR_PTR(-EPROBE_DEFER); -- 2.43.0