iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()
PATCH 1/1 iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()
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.
--- drivers/iio/inkern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/inkern.c +1 -1
@@ -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;
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerQuoted 10 lines · On Sat, 2 Nov 2024 09:25:25 +0000 Zicheng Qu <[email protected]> wrote:
In the
fwnode_iio_channel_get_by_name(), iterating over parent nodes to acquire IIO channels viafwnode_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 [email protected] # v6.6+Fixes 1e64b9c5f9a0 ("iio: inkern: move to fwnode properties")Signed-off-by Zicheng Qu <[email protected]>
Hi Zicheng,
Good catch. I briefly wondered if this was unused code. It is used, just not that much and it seems not on boards anyone is testing.
arch/arm/boot/dts/st/ste-ux500-samsung-janice.dts
Anyhow, fix looks good to me. Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/inkern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/inkern.c +1
-1@@ -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;