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; } From patchwork Tue Feb 20 11:50:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13563927 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 6E157C48BC4 for ; Tue, 20 Feb 2024 11:50:38 +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=JffZZBLzaKM2swlBZ+uaa4AcVaqkDJK4tH++hLNJujo=; b=LqT0Cvym2kQnTd opGiLJOc0vvh+sJ6cg12FeDhaPoGey+oOBY8r8bIu7YH7obgWkuGLuOfTjgcsk4W6vA3I1c2+SaXY +5BwBe+hWuOivI4A78YAqqv9ZPcPAtaSTK1880+aeiKrpNDO5DM186uKpdOTG0BSJUZWz9OOxLbXh tyPHiwNTlGUsk9H6KrVn9tX9tJ9e7SCUqQS4tUa263Tsh0CaK7br0rgUFQCnJYESps31LED+w3ekO bJQ/911osO5FNtp9CMUOvHaIROZCSndIEfuaecP696/+v/ewcYgoaxtqhzQeXrp9z6UGicRI93xr5 jHDXFXg0Qrp5QpSwtW1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdq-0000000EWn9-0A9b; Tue, 20 Feb 2024 11:50:30 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdg-0000000EWhe-0dsN for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 11:50:22 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-55a5e7fa471so5576124a12.1 for ; Tue, 20 Feb 2024 03:50:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708429819; x=1709034619; 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=jIz2a8ZPV5qqMCqIcgKN9srCLfbQdXRH6UOg+1LhDuc=; b=W27HxddBMD+I4g4SZn0a/9uMTcS5bJN3YoQNPtxVjO9gxSC/1D5inaWeFQrJgZWU8w i4kv4Vdp0whEQxoMt1nF0JegLZVMDtsWfUEGTE2+T0v2pzBAcaGmB397LxX2/SBpIiTF bjDu8OxbDpWLgH9fIn/0nY7uVblClGbgcUQ4HP+iP+0eAd+MsfaD+FuWifNepfEB4Bnf nV4D85OAihsA1ex6sARZ8q7hWM65ehTn6U7c7Cvr4RSlDf5pm+1LkI+euzd3a/1JS9Aw 7X9lfTYVu3usgf+4eWus9z225GCWANODmjIDpfZa8oNEgUBCrQr5rjRWrejVQrYE2nCH Rm9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708429819; x=1709034619; 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=jIz2a8ZPV5qqMCqIcgKN9srCLfbQdXRH6UOg+1LhDuc=; b=HwnBpEyzMCmIk6gm8tV13wyUy6Ma5t05r/bV/KMxWL36hj73ILFBX9eVpXIxduaj9y dQTRJVsjEgJ/XjarSjoCvPIYZ1ihxUzpAgdvMY2yBTLIyP5Sc0KweSxxL9Iw2OLfG9wo 8+zIjNHfBNRfYHm3k6iHQ0jtFjILn38rkU8259nkgwXsbDVSPBc167gf0qI/oEc2ND7v NmgXb/XjgEQMVz4HAa9uCgnLBw5W6KnKw6Zw+c6xKr4jELwXAxwr2ObMkJtAfxbSaH47 VoE1SF6tPApLMLbmQ5eOnCdK4p6y2A21vAN5luupnfpcgH1F2s26YqgE8GNRckM9a4FT NpHA== X-Forwarded-Encrypted: i=1; AJvYcCXiDwG/h3SM3XQiHJ45DCBVvJc13g5ROno57jzgLB2mqk3WfI4v/3+DnfktSvE6TdoN6qSX5jwH8mtzCcj1FnOl2EOAzfp3cyUG1n40egBH0K6/Zjg= X-Gm-Message-State: AOJu0Yz17kCPsz5FhEcRqQNc8WWbIy2LtSCfazwd1GQ9uIqpo/3ppHC6 UQo8kwm8Zpj7JRkbcU0oh8/OnJAok/TAqdLrFkW0fr6nq4anEBgbDnkoR4U5GLSG0QbeyumzLS6 g X-Google-Smtp-Source: AGHT+IHW4GEpTJv1ZnaGPtiU1q+9ICdDV892ZtDa1+jkryGHrkMoTGFQm/ZjleeVFtcfumHH9c72YQ== X-Received: by 2002:aa7:d4d9:0:b0:564:4f6f:a7ff with SMTP id t25-20020aa7d4d9000000b005644f6fa7ffmr4449767edr.20.1708429818757; Tue, 20 Feb 2024 03:50:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:50:17 -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 2/3] mfd: syscon: remove extern from function prototypes Date: Tue, 20 Feb 2024 11:50:11 +0000 Message-ID: <20240220115012.471689-3-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_211258_F83C10E5 X-CRM114-Status: GOOD ( 10.69 ) 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 The kernel coding style does not require 'extern' in function prototypes in .h files, so remove them as they are not needed. To avoid checkpatch warnings such as CHECK: Lines should not end with a '(' +struct regmap *syscon_regmap_lookup_by_phandle( The indentation is also updated. No functional changes in this patch. Signed-off-by: Peter Griffin --- include/linux/mfd/syscon.h | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index fecc2fa2a364..c315903f6dab 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h @@ -17,20 +17,17 @@ struct device_node; #ifdef CONFIG_MFD_SYSCON -extern struct regmap *device_node_to_regmap(struct device_node *np); -extern struct regmap *syscon_node_to_regmap(struct device_node *np); -extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); -extern struct regmap *syscon_regmap_lookup_by_phandle( - struct device_node *np, - const char *property); -extern struct regmap *syscon_regmap_lookup_by_phandle_args( - struct device_node *np, - const char *property, - int arg_count, - unsigned int *out_args); -extern struct regmap *syscon_regmap_lookup_by_phandle_optional( - struct device_node *np, - const char *property); +struct regmap *device_node_to_regmap(struct device_node *np); +struct regmap *syscon_node_to_regmap(struct device_node *np); +struct regmap *syscon_regmap_lookup_by_compatible(const char *s); +struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, + const char *property); +struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np, + const char *property, + int arg_count, + unsigned int *out_args); +struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np, + const char *property); #else static inline struct regmap *device_node_to_regmap(struct device_node *np) { From patchwork Tue Feb 20 11:50:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13563929 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 87E33C54787 for ; Tue, 20 Feb 2024 11:50:41 +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=tMyphh1z+rHukgZ8fUqac1sMmwzOz4Q7ggvdopP8RU8=; b=Oh7XhK7V8iUeSY zr3V3Aw0mK8f6HAnr50VCKy5ulYs3iHcHDT7TS6jKW1y8XcdEqhBpcj9+m4Vr8zEEySkP9CvaUwmd 0i4Xo5Rslr9Jz2pkVbnS1tu+7TNjUBONNnSYXgWFOpc/AseBGlmH6v5wD10XjUhqJY6I9g5Iyy4x8 42V1yaJzarxpOKvm/PkiWIPpwcSU41sQmXAW3HDZWZb49Gt6U9aELWDwKAAjqXeKORwiwE641DRAf 8NZg03VUzqu7jEp+tfwn633Xf48bg1lRC68PABcC1igAujeKUPc1/F7Xi+YMt51itQTTZptJjEWor tHjs6wVRSA5ChduPBfPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdq-0000000EWnr-4C5L; Tue, 20 Feb 2024 11:50:31 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcOdi-0000000EWit-0cIH for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 11:50:23 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-563c0f13cabso6516934a12.3 for ; Tue, 20 Feb 2024 03:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708429820; x=1709034620; 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=NLPhn5F1IILXAvLH2tiC+iCBpGghWpYxEC9f2Dxu3S0=; b=CrRfh/cH+koKt6s4UfQsIW6ogIdlkNcbmDUCxxoVgRYGxmNawVSsflpcA14ergosvv O5ZV2p5d9Z9TAbxi7LlqIKJ6NbOUEq0z5+3RPRZDVhjWBxgKZ/oOgbrajsblfkdqUDTp e3ybREopQb17l/bLsGjWNOfhxJ7w3aQ6kvYRpAaf7XHbjbo1N1HWq7BT75Qn0b9DPa3m aB7hk1y+uga8xg+/zlv+EdLMLYNksv/QauKCgmeX1tiu0vgRgkWfLRqcJ7kbK9NeiWKo fgXS1NPVNf/CJDzFtL8MAkDmFuQ30HqpLTkj1pOY51wgxCeEnUZKwxUTt1KdgfhYRbPg UlxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708429820; x=1709034620; 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=NLPhn5F1IILXAvLH2tiC+iCBpGghWpYxEC9f2Dxu3S0=; b=NFXeYwEtFVY52umZJHy2dXsrAr5raU6X9W6CiSrDDOfA+qUKeYLitzyr4RwO9jtWPQ HabTZGSGrxvm0ZU61IR23NJ7rrhdxehOxymP1lt/PQ+PGFCnMXc+DoCXRa9LE4opoN3I h5LD1RSFCYswbCrnEbHVFpt4Rgdo8VZ7zn7SYWGF5uoIYnC2+oaEs2AQX61Sg77+ZAez ubjdGodwU9eizW1iid+8HI8zaQQY9u7SjnTlpRdI4qlib0JKVa8rdIaQ1xVO8XzRRCTJ UIOJTR105R3ZTrd1+G02nKWPiokwDsNRyYjDE6jry4K+DU3Uo2HKKjUqSFALGvYEyMOL 1xHA== X-Forwarded-Encrypted: i=1; AJvYcCX3J8Zuwg+TjnBzDvqqxHdhh3AAWaKZerIH3jbZiA4GgUTblZHMOu31CerH5NdDZAIKkr3rgYLJ1+2PX+g+jqP8b6lF1Yb2MLbPeByWk1R/+irPQbA= X-Gm-Message-State: AOJu0YwLN+gWeqTyp4iTyBsq7sDY7DpSaJWzhHC2wo9JNhMnub4SiUfr u0QOS7BxtMZvP0ieOSEIsT0QFg+KN/YEDvsdwezgt+4VjpIKXZ3F+5BW4Ktuwaw= X-Google-Smtp-Source: AGHT+IEV2SGfyL00WThZuIpxrCxkMf+jEK6pTjTLPCvz1phzExr0o/5hORq48Qd+ppjGItJ2AO/NBA== X-Received: by 2002:a05:6402:1b1a:b0:55f:6a87:8033 with SMTP id by26-20020a0564021b1a00b0055f6a878033mr12182959edb.31.1708429820121; Tue, 20 Feb 2024 03:50:20 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:50:19 -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 3/3] mfd: altera-sysmgr: call of_node_put() only when of_parse_phandle() takes a ref Date: Tue, 20 Feb 2024 11:50:12 +0000 Message-ID: <20240220115012.471689-4-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_035022_265161_70088CB7 X-CRM114-Status: GOOD ( 13.41 ) 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: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager") Signed-off-by: Peter Griffin --- 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 0e52bd2ebd74..fb5f988e61f3 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);