Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()
@ 2024-11-02  9:25 Zicheng Qu
  2024-11-02 15:18 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Zicheng Qu @ 2024-11-02  9:25 UTC (permalink / raw)
  To: jic23, lars, nuno.sa, andy.shevchenko, linux-iio, linux-kernel
  Cc: tanghui20, zhangqiao22, judy.chenhui, quzicheng

In the fwnode_iio_channel_get_by_name(), iterating over parent nodes to
acquire IIO channels via fwnode_for_each_parent_node(). The variable
chan was mistakenly attempted on the original node instead of the
current parent node. This patch corrects the logic to ensure that
__fwnode_iio_channel_get_by_name() is called with the correct parent
node.

Cc: stable@vger.kernel.org # v6.6+
Fixes: 1e64b9c5f9a0 ("iio: inkern: move to fwnode properties")
Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
---
 drivers/iio/inkern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 151099be2863..3305ebbdbc07 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -269,7 +269,7 @@ struct iio_channel *fwnode_iio_channel_get_by_name(struct fwnode_handle *fwnode,
 			return ERR_PTR(-ENODEV);
 		}
 
-		chan = __fwnode_iio_channel_get_by_name(fwnode, name);
+		chan = __fwnode_iio_channel_get_by_name(parent, name);
 		if (!IS_ERR(chan) || PTR_ERR(chan) != -ENODEV) {
 			fwnode_handle_put(parent);
  			return chan;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-02 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-02  9:25 [PATCH] iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name() Zicheng Qu
2024-11-02 15:18 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox