Commit 21dcd49f authored by Andy Shevchenko's avatar Andy Shevchenko

Merge patch series "pinctrl: intel: platform: fix error path in device_for_each_child_node()"

Javier Carrasco <javier.carrasco.cruz@gmail.com> says:

This series fixes an error path where the reference of a child node is
not decremented upon early return. When at it, a trivial comma/semicolon
substitution I found by chance has been added to improve code clarity.

Link: https://lore.kernel.org/r/20240926-intel-pinctrl-platform-scoped-v1-0-5ee4c936eea3@gmail.comSigned-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parents 9852d85e d594de89
...@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev, ...@@ -90,7 +90,6 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
struct intel_community *community, struct intel_community *community,
struct intel_platform_pins *pins) struct intel_platform_pins *pins)
{ {
struct fwnode_handle *child;
struct intel_padgroup *gpps; struct intel_padgroup *gpps;
unsigned int group; unsigned int group;
size_t ngpps; size_t ngpps;
...@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev, ...@@ -131,7 +130,7 @@ static int intel_platform_pinctrl_prepare_community(struct device *dev,
return -ENOMEM; return -ENOMEM;
group = 0; group = 0;
device_for_each_child_node(dev, child) { device_for_each_child_node_scoped(dev, child) {
struct intel_padgroup *gpp = &gpps[group]; struct intel_padgroup *gpp = &gpps[group];
gpp->reg_num = group; gpp->reg_num = group;
...@@ -159,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev, ...@@ -159,7 +158,7 @@ static int intel_platform_pinctrl_prepare_soc_data(struct device *dev,
int ret; int ret;
/* Version 1.0 of the specification assumes only a single community per device node */ /* Version 1.0 of the specification assumes only a single community per device node */
ncommunities = 1, ncommunities = 1;
communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL); communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL);
if (!communities) if (!communities)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment