Commit 14659c1a authored by Zicheng Qu's avatar Zicheng Qu Committed by Wen Zhiwei
Browse files

iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()

stable inclusion
from stable-v6.6.64
commit 98e1f03de842d0e8cd6c1171f40ce7ba998290bd
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBL4B6

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=98e1f03de842d0e8cd6c1171f40ce7ba998290bd



--------------------------------

commit 3993ca4add248f0f853f54f9273a7de850639f33 upstream.

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: 1e64b9c5 ("iio: inkern: move to fwnode properties")
Signed-off-by: default avatarZicheng Qu <quzicheng@huawei.com>
Link: https://patch.msgid.link/20241102092525.2389952-1-quzicheng@huawei.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 1e15e6bd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,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;