Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2389356lqp; Sun, 24 Mar 2024 17:16:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlpqZQUTUDK2aFG+2yjQQmlmDNEBGejwaJFNH0nEMb4Q7ZRBhi0DzEPJ5kiueJGLm4UfuN2AHppGvSRbtGVfADlkvgTEK7tsrIrdQo1w== X-Google-Smtp-Source: AGHT+IHhB4q2treAbYHvEJPJIVYv9F3ZRpyttnAO6vI606VgOD4m0SfRcVarfz5hbMysAxh12HzC X-Received: by 2002:ac8:5794:0:b0:430:caf4:5bba with SMTP id v20-20020ac85794000000b00430caf45bbamr8098172qta.2.1711325783189; Sun, 24 Mar 2024 17:16:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325783; cv=pass; d=google.com; s=arc-20160816; b=Kxao82gB28L6Leiguw9GJH6h+hss0g8Henmh1gCE/sS/1brI2HbtW12kTBHng3MPM0 YZdPPG0XKOOH5MqlhK/HEnAh0A35W8bNntEZ/wTQzibOaccMc+++AGsatY+IznNLPtqL rdKXRGmSgaUe3qVvAJuq0/Ig1DT8PW8eC4BrHjxQf7DCsuqeXFMCu6K5YhJbihBMS7Fj 2d/j7j6+GPkSIkyuyYXVR5o8PBPQaUOMzWj561Egh6M0azr4K/TwS81w7nLRzg8pzEWp POBNiVPKm9Fd92pbTz3On7je2jkj8jIZ9gaDMG3dIGTo2KxTEjNFBGw0Vp6tI2MTgU/m muAQ== 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=AkeuHDF/U9oxXoN1djOlOQT3QI/+esR2cmIonn2U5/0=; fh=KXyW26nOJVhyZBrBMcColsGz6kKR7G/JY7sJfcY1W2A=; b=Ozbnu93P+iv03GNVIIH5t70iFdW1pP/E956RUH/daVo+Ytf+Ukntk00adzLWL3AvH/ 0K8LLfBtiStuqJBmAkCerEz9ULR9vddkHmnEHqYMR2HoFJ37i60799hwAxAMKIqFw2VW XUci2G9Mh7rddB4tQ/7RtTbhyVCS3kMj85XM1itn413hg4/0x/SbfAb/8T0hW+wfgJCv 8+tJ59SwcNVxbXIgOqLC5405pTMj5ol6J0Kuxcfv7IEv8HbcVTgMxS1DTwH1YK5NPzOZ +VWFBGLtKujMdi0csm3PovHFraf7JBDHfwMrSg3k9Q8TbevCGp06G2jA7igEq59YUpDe 1Whg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gSWmVBIm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113353-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o17-20020a05622a009100b00431388941c1si4460065qtw.267.2024.03.24.17.16.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113353-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gSWmVBIm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113353-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113353-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E2FB51C23A27 for ; Mon, 25 Mar 2024 00:16:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1FEC19ABF0; Sun, 24 Mar 2024 22:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gSWmVBIm" 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 C2F2A19A61C; Sun, 24 Mar 2024 22:42:33 +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=1711320153; cv=none; b=NDjASuGFEpW0to+be1TBFBVXrVPk1Fzq2eqb2YkUUxuC433JRN4BYe2QKgtu8GO/rIolpZXHli5AgEjkjuVJC92Tb83/i/vJeJaAN/kuWtI0HlP/lOSwuV/siI73MWg7eduexHRTuM6HmLVkOEF6aWF3jRYyiE/S6f1xVYg1O2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320153; c=relaxed/simple; bh=6QT672QOnXtfVyI1jQ2OIfo7bcqP0hm5arRscEAGI0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qc8JUAYA2BoFWuwfo++j+n/XMkziCGEJUMavo3SD1DC5zJs1YviZb7/TTfL+ierlN1PXjFRAxw2DMSYIHyhZIdThMHx723YiCLNsuqCE2FaA6x4/qWmGIU+GKunPuiiF1rAxI1u2/+zjFMkgsT4EF0DV2B4mP0Wm9/oBPqLLdOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gSWmVBIm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09964C43390; Sun, 24 Mar 2024 22:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320153; bh=6QT672QOnXtfVyI1jQ2OIfo7bcqP0hm5arRscEAGI0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSWmVBImuepcCTV4tKPng4wCuM6BNM/TOl0rWjxtirSkXgyiLb4FmhLmRtq07qV55 TqD/7GossVstpkqo8WuViV9cPzhhTFW2ifsSmtXE3xPkOphhC3+5vx1op74wty/GbK LwDSr4qm/303Hs7KAKwTQkYLf3zdf8KnxT2zRiqf8rkpTwA4Fa7FHRnG+9cu8O/Zzz GrHnHOdybuVvVBAwTGESdWgvbzLeUc2YULR4zmpZhXiO1Ly1fvUCqRCKka8/4U93Y+ +mfoKKstDgj9QFyjLCzo7DbJ/mnuszfLnXn1lKp4sv8HdwP9qP0YYc25l7RV1XWlqI UrASkEoeg9LlQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Griffin , Lee Jones , Sasha Levin Subject: [PATCH 6.8 462/715] mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref Date: Sun, 24 Mar 2024 18:30:41 -0400 Message-ID: <20240324223455.1342824-463-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 d2b0680cf3b05490b579e71b0df6e07451977745 ] 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: 45330bb43421 ("mfd: syscon: Allow property as NULL in syscon_regmap_lookup_by_phandle") Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20240220115012.471689-2-peter.griffin@linaro.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index c9550368d9ea5..7d0e91164cbaa 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -238,7 +238,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, return ERR_PTR(-ENODEV); regmap = syscon_node_to_regmap(syscon_np); - of_node_put(syscon_np); + + if (property) + of_node_put(syscon_np); return regmap; } -- 2.43.0