software node: fix wrong node passed to find nargs_prop
Subsystems (3)
PATCH 1/1 software node: fix wrong node passed to find nargs_prop
nargs_prop refers to a property located in the reference that is found within the nargs property. Use the correct reference node in call to property_entry_read_int_array() to retrieve the correct nargs value.
--- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/swnode.c +1 -1
@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,return -ENOENT ;if (nargs_prop) { - error =property_entry_read_int_array (swnode->node->properties, + error =property_entry_read_int_array (ref->node->properties, nargs_prop,sizeof (u32), &nargs_prop_val,1 );if (error)
Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): CAHp75Vf+F2L4EFmokRYD+-M9hSuz+SbiiWnqHvFZttRyfKS-mg@mail.gmail.com
Daniel Scally
reviewerThanks Andy
Quoted 7 lines · Andy Shevchenko
+ Sakari, Dan
On Monday, December 20, 2021, Clément Léger <[email protected] <mailto:[email protected]>> wrote:
nargs_proprefers to a property located in the reference that is found within the nargs property.
I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of fwnode_property_get_reference_args() pass anything to nargs_prop anyway...do we even need this?
Use the correct reference node in call to
Quoted 4 lines
property_entry_read_int_array()to retrieve the correct nargs value.Fixes b06184acf751 ("software node: Add
software_node_get_reference_args()")
I think this might have been introduced later...maybe 996b0830f95d1, maybe e933bedd45099
Quoted 34 lines
Signed-off-by: Clément Léger <[email protected] <mailto:[email protected]>> --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 4debcea4fb12..0a482212c7e8 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode, return -ENOENT; if (nargs_prop) { - error = property_entry_read_int_array(swnode->node->properties, + error = property_entry_read_int_array(ref->node->properties, nargs_prop, sizeof(u32), &nargs_prop_val, 1); if (error) -- 2.34.1Signature · 2 lines
With Best Regards, Andy Shevchenko
Greg Kroah-Hartman
maintainerQuoted 8 lines · Daniel Scally
Thanks Andy
Quoted 5 lines · Andy Shevchenko
+ Sakari, Dan
On Monday, December 20, 2021, Clément Léger <[email protected] <mailto:[email protected]>> wrote:
Quoted 7 lines
Quoted 2 lines
nargs_proprefers to a property located in the reference that is found within the nargs property.I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?
Looks like it is unused, please just remove it.
thanks,
greg k-h
Sakari Ailus
reviewerHi Greg, Andy,
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Daniel Scally
Thanks Andy
Quoted 7 lines · Andy Shevchenko
+ Sakari, Dan
On Monday, December 20, 2021, Clément Léger <[email protected] <mailto:[email protected]>> wrote:
nargs_proprefers to a property located in the reference that is found within the nargs property.
Quoted 6 lines
Quoted 4 lines
I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?Looks like it is unused, please just remove it.
If you remove nargs_prop argument, then callers will have to use OF property API instead to parse references with property-defined number of arguments. The goal has been to cover all functionality in a firmware-independent way.
Signature · 3 lines
Regards, Sakari Ailus
Daniel Scally
reviewerHi Sakari
Quoted 20 lines · Sakari Ailus
Hi Greg, Andy,
Quoted 17 lines · Greg Kroah-Hartman
Quoted 15 lines · Daniel Scally
Thanks Andy
Quoted 7 lines · Andy Shevchenko
+ Sakari, Dan
On Monday, December 20, 2021, Clément Léger <[email protected] <mailto:[email protected]>> wrote:
nargs_proprefers to a property located in the reference that is found within the nargs property.I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?
Quoted 6 lines
Quoted 1 line
Looks like it is unused, please just remove it.
If you remove
nargs_propargument, then callers will have to use OF property API instead to parse references with property-defined number of arguments. The goal has been to cover all functionality in a firmware-independent way.
My mistake, I missed that of_parse_phandle_with_args() has a ton of direct users. I guess we should try to replace those with fwnode_property_get_reference_args() where appropriate.
Sakari Ailus
reviewerHi Daniel,
Quoted 25 lines · Daniel Scally
Hi Sakari
Quoted 22 lines · Sakari Ailus
Hi Greg, Andy,
Quoted 18 lines · Greg Kroah-Hartman
Quoted 8 lines · Daniel Scally
Thanks Andy
Quoted 5 lines · Andy Shevchenko
+ Sakari, Dan
On Monday, December 20, 2021, Clément Léger <[email protected] <mailto:[email protected]>> wrote:
Quoted 7 lines
Quoted 2 lines
nargs_proprefers to a property located in the reference that is found within the nargs property.I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?Looks like it is unused, please just remove it.
Quoted 8 lines
Quoted 4 lines
If you remove
nargs_propargument, then callers will have to use OF property API instead to parse references with property-defined number of arguments. The goal has been to cover all functionality in a firmware-independent way.My mistake, I missed that
of_parse_phandle_with_args()has a ton of direct users. I guess we should try to replace those withfwnode_property_get_reference_args()where appropriate.
I'd say at least when the code is otherwise using fwnode property API.
I guess most of the reference users are OF-based originally while cameras are perhaps a bit of an exception to this. :-)
Signature · 3 lines
Regards, Sakari Ailus
Quoted 9 lines · Daniel Scally
Thanks Andy
On 20/12/2021 22:13, Andy Shevchenko wrote:
[...]I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?
Indeed, this is currently not used anywhere, nargs is always used instead of nargs_prop. The usage is meant to be (almost) the same as of_parse_phandle_with_args().
ie:
ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
index, &args);
can be replaced by:
ret = fwnode_property_get_reference_args(node, "resets",
"#reset-cells", 0 index, &args);
I have some patches that uses that with software nodes and that will need this support.
Quoted 9 lines
Use the correct reference node in call to
Quoted 4 lines
property_entry_read_int_array()to retrieve the correct nargs value.Fixes b06184acf751 ("software node: Add
software_node_get_reference_args()")I think this might have been introduced later...maybe
996b0830f95d1, maybee933bedd45099
From what I saw, it was already in the original commit adding this but I can be wrong.
Quoted 35 lines
Quoted 35 lines
Signed-off-by: Clément Léger <[email protected] <mailto:[email protected]>> --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 4debcea4fb12..0a482212c7e8 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode, return -ENOENT; if (nargs_prop) { - error = property_entry_read_int_array(swnode->node->properties, + error = property_entry_read_int_array(ref->node->properties, nargs_prop, sizeof(u32), &nargs_prop_val, 1); if (error) -- 2.34.1Signature · 2 lines
With Best Regards, Andy Shevchenko
Signature · 3 lines
Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com
Hello
Quoted 22 lines · Clément Léger
Quoted 9 lines · Daniel Scally
Thanks Andy
On 20/12/2021 22:13, Andy Shevchenko wrote:
[...]I think this is right (it's not used in the ACPI version, and the OF version is quite convoluted so a bit hard to follow)...but also I note that none of the users of
fwnode_property_get_reference_args()pass anything tonargs_propanyway...do we even need this?Indeed, this is currently not used anywhere, nargs is always used instead of
nargs_prop. The usage is meant to be (almost) the same asof_parse_phandle_with_args().ie:
ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
index, &args);
Quoted 8 lines
can be replaced by:
ret = fwnode_property_get_reference_args(node, "resets",
"#reset-cells", 0 index, &args);I have some patches that uses that with software nodes and that will need this support.
Ok, in that case I think this is the right thing to do and you can have my:
Might be nice to transfer the function comment from of_parse_phandle_with_args() to fwnode_property_get_reference_args(), as that's nice and clear.
Quoted 4 lines
Quoted 4 lines
Use the correct reference node in call to
Quoted 2 lines
property_entry_read_int_array()to retrieve the correct nargs value.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Fixes: b06184acf751 ("software node: Add software_node_get_reference_args()")I think this might have been introduced later...maybe
996b0830f95d1, maybee933bedd45099From what I saw, it was already in the original commit adding this but I can be wrong.
You're right of course - sorry for the noise
Quoted 38 lines
Quoted 35 lines
Quoted 35 lines
Signed-off-by: Clément Léger <[email protected] <mailto:[email protected]>> --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 4debcea4fb12..0a482212c7e8 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode, return -ENOENT; if (nargs_prop) { - error = property_entry_read_int_array(swnode->node->properties, + error = property_entry_read_int_array(ref->node->properties, nargs_prop, sizeof(u32), &nargs_prop_val, 1); if (error) -- 2.34.1Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Clément Léger
nargs_proprefers to a property located in the reference that is found within the nargs property. Use the correct reference node in call toproperty_entry_read_int_array()to retrieve the correct nargs value.Fixes b06184acf751 ("software node: Add software_node_get_reference_args()")Signed-off-by Clément Léger <[email protected]>
Thank you (and thanks to Andy for cc'ing me).
Quoted 17 lines
--- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/base/swnode.c +1
-1@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,return -ENOENT ;if (nargs_prop) { - error =property_entry_read_int_array (swnode->node->properties, + error =property_entry_read_int_array (ref->node->properties, nargs_prop,sizeof (u32), &nargs_prop_val,1 );if (error)
Signature · 1 line
Sakari Ailus
Quoted 6 lines · Clément Léger
nargs_proprefers to a property located in the reference that is found within the nargs property. Use the correct reference node in call toproperty_entry_read_int_array()to retrieve the correct nargs value.Fixes b06184acf751 ("software node: Add software_node_get_reference_args()")Signed-off-by Clément Léger <[email protected]>
Quoted 19 lines
--- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/base/swnode.c +1
-1@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,return -ENOENT ;if (nargs_prop) { - error =property_entry_read_int_array (swnode->node->properties, + error =property_entry_read_int_array (ref->node->properties, nargs_prop,sizeof (u32), &nargs_prop_val,1 );if (error)Signature · 1 line
2.34.1
Signature · 1 line
heikki
Quoted 10 lines · Heikki Krogerus
Quoted 6 lines · Clément Léger
nargs_proprefers to a property located in the reference that is found within the nargs property. Use the correct reference node in call toproperty_entry_read_int_array()to retrieve the correct nargs value.Fixes b06184acf751 ("software node: Add software_node_get_reference_args()")Signed-off-by Clément Léger <[email protected]>Acked-by Heikki Krogerus <[email protected]>
Applied as 5.17 material, thanks!
Quoted 22 lines
Quoted 18 lines
--- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/base/swnode.c +1
-2@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,return -ENOENT ;if (nargs_prop) { - error =property_entry_read_int_array (swnode->node->properties, + error =property_entry_read_int_array (ref->node->properties, nargs_prop,sizeof (u32), &nargs_prop_val,1 );if (error) --Quoted 1 line
2.34.1
--
heikki