From: Peter Griffin <peter.griffin@linaro.org> 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 <peter.griffin@linaro.org> 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 [thread overview] Message-ID: <20240220115012.471689-2-peter.griffin@linaro.org> (raw) In-Reply-To: <20240220115012.471689-1-peter.griffin@linaro.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 <peter.griffin@linaro.org> --- 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; } -- 2.44.0.rc0.258.g7320e95886-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Peter Griffin <peter.griffin@linaro.org> 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 <peter.griffin@linaro.org> 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 [thread overview] Message-ID: <20240220115012.471689-2-peter.griffin@linaro.org> (raw) In-Reply-To: <20240220115012.471689-1-peter.griffin@linaro.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 <peter.griffin@linaro.org> --- 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; } -- 2.44.0.rc0.258.g7320e95886-goog
next prev parent reply other threads:[~2024-02-20 11:50 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-20 11:50 [PATCH 0/3] mfd syscon and altera-sysmgr cleanup Peter Griffin 2024-02-20 11:50 ` Peter Griffin 2024-02-20 11:50 ` Peter Griffin [this message] 2024-02-20 11:50 ` [PATCH 1/3] mfd: syscon: call of_node_put() only when of_parse_phandle() takes a ref Peter Griffin 2024-02-20 11:50 ` [PATCH 2/3] mfd: syscon: remove extern from function prototypes Peter Griffin 2024-02-20 11:50 ` Peter Griffin 2024-02-20 11:50 ` [PATCH 3/3] mfd: altera-sysmgr: call of_node_put() only when of_parse_phandle() takes a ref Peter Griffin 2024-02-20 11:50 ` Peter Griffin 2024-02-23 16:02 ` [PATCH 0/3] mfd syscon and altera-sysmgr cleanup Lee Jones 2024-02-23 16:02 ` Lee Jones
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240220115012.471689-2-peter.griffin@linaro.org \ --to=peter.griffin@linaro.org \ --cc=andre.draszik@linaro.org \ --cc=arnd@arndb.de \ --cc=kernel-team@android.com \ --cc=krzysztof.kozlowski@linaro.org \ --cc=lee@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=pankaj.dubey@samsung.com \ --cc=saravanak@google.com \ --cc=thor.thayer@linux.intel.com \ --cc=tudor.ambarus@linaro.org \ --cc=willmcvicker@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.