From patchwork Tue Feb 20 11:50:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13563928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77C14C48BC3 for ; Tue, 20 Feb 2024 11:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NTqMKpaDNsc3TIpVPpy5ukBLGi+gyKIw961aifzeSeI=; b=ODaAtJqNByi7Wd O8pr44qMyR3XOxnUbHAkL9+f9qsHYEhSqV6TwkeSY7GZ2lsIUEjNYezJZQoa56nYwCxSAB3Z1y1n+ SvEZx3DtsYzpcMiO04XtW/UET8weunhUZGNsTDZUuxttst2HndX0Yi09Jn4/Y11IgmDvVieKCr6ya AJnFUNoqOSGjwA5fPvoUv755At+riWAJbNYe988E+QOma4iFV9N9MszAO3pGrpTVtaKYZc+NKDhXB oyuNGZ7Z/nyMpP2NrfI7gItEq9FaJqvpIOHdD8dBjmDttxz3Dn7vEO9ddlGaO49xE5kfg7Z3AJL9k gRTvYVsOn5WMPtZam6/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdo-0000000EWmC-3jjy; Tue, 20 Feb 2024 11:50:28 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdf-0000000EWhV-3vks for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 11:50:21 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-55a035669d5so8888628a12.2 for ; Tue, 20 Feb 2024 03:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708429817; x=1709034617; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NC5xe2uxCxCjh2/t9Ad3AWpCcmsygcw6ycwZ3qcHHbA=; b=j2x7o9FkfGeiSeZOlr8dAe41fSpGpLB0JVc9M8GNr4ODGKyxdsWtr/alX/UrqNbxFO vsXQRSY+2CN9sKKvkmSYYKE/JjnPurJ3V55Q462RG6UR+IPyo6OeeZd8NaeLMR8qHqet 2WHcdhUtzIOb6KRxnJKy4WoNgdIGfbk79S32KxrPc2e42G6spW2PKKlnwcpWnDW4rIzz PDpvSeaqMtndU9I3d5m6JPT0CDAkEJWSt6JobxhmCWzM98H8dUciLfcawf62xr9DDFR6 LsMQozsLJ3x498BWr1jsJR6gMGgZ5bWLz/v/BXW6maxf0FY0SNtxhsTd79JetVl/YKQU d2Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708429817; x=1709034617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NC5xe2uxCxCjh2/t9Ad3AWpCcmsygcw6ycwZ3qcHHbA=; b=ooUuDySnq/dluJxwsP1kkLbMoTKLqYOd4+xy3Gv7I75t11IUPYgN5wtAFUdAgNToxV wUorPoRL+WFVjcfNuVBdbzWCRHHmzt6RmaeyKjCAEq+pqBjMCahGATllO8rbAAN52Uy6 eGGzr8R/MOZyQirXnQKZIOP0UTx/F6MWfzywef3huJvq2UBjs7kBpXs3iKtHnN3AK/2l UACS9MHipfK/PL6x8ntOC5ESq0Wnryv+gfkcx6SjQ5/Q1lp0RldG4qDU8C65VOtGEePn jZW0qU0ODu7rvDzjPjC4jRFGieSVr+q6p2O5q/1T22KC0AVja17KdH/wGAQNXJYkwtcM sMpg== X-Forwarded-Encrypted: i=1; AJvYcCVjDKdbhNUORIKF5gSmBzHy8qsNIyPKTVF6xkpwGMniC1jfImWhC1VYAjJqChxgl2KWf+Y66gVe4liAbuEaTnq7HZxrGjDbZwjWVAE9GfeUiyVvqtc= X-Gm-Message-State: AOJu0YyaOfhLrpCzupzup8ekbxmRQPxFcn14XDlXY15VHqXe1bpkc7ki yItFNNUleZxlY/xl8kvFNgTBWOUjuCoEwDHedv/CmMvGk94RtxBuTrB/rSShSyw= X-Google-Smtp-Source: AGHT+IHWonUk0gf2gS9NP3Mffmo3xRF5rOyDEcgBiEuKiQquO9Tz7OelEZHlUqVEo8Ytw6LZzC6lJA== X-Received: by 2002:a05:6402:693:b0:564:56e0:5643 with SMTP id f19-20020a056402069300b0056456e05643mr3817369edy.27.1708429817344; Tue, 20 Feb 2024 03:50:17 -0800 (PST) Received: from gpeter-l.lan (host-92-18-74-232.as13285.net. [92.18.74.232]) by smtp.gmail.com with ESMTPSA id u16-20020aa7db90000000b005645c4af6c7sm2317832edt.13.2024.02.20.03.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:50:16 -0800 (PST) From: Peter Griffin To: arnd@arndb.de, lee@kernel.org, thor.thayer@linux.intel.com Cc: kernel-team@android.com, krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, pankaj.dubey@samsung.com, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, Peter Griffin Subject: [PATCH 1/3] mfd: syscon: call of_node_put() only when of_parse_phandle() takes a ref Date: Tue, 20 Feb 2024 11:50:10 +0000 Message-ID: <20240220115012.471689-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240220115012.471689-1-peter.griffin@linaro.org> References: <20240220115012.471689-1-peter.griffin@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_035020_007857_8B83E477 X-CRM114-Status: GOOD ( 13.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 c9550368d9ea..7d0e91164cba 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; }