Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems()

of_property_count_u32_elems() might return an error code in some cases.
It's naturally better to assign what it's returned to the err variable
and supply the real code to the upper layer(s). Besides that, it's a
common practice to avoid assignments for the data in cases when we know
that the error condition happened. Refactor the code accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231129161459.1002323-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
c82c0381 9e863d27

+4 -3
+4 -3
drivers/pinctrl/pinctrl-equilibrium.c
··· 715 715 if (!prop) 716 716 continue; 717 717 718 - group.num_pins = of_property_count_u32_elems(np, "pins"); 719 - if (group.num_pins < 0) { 718 + err = of_property_count_u32_elems(np, "pins"); 719 + if (err < 0) { 720 720 dev_err(dev, "No pins in the group: %s\n", prop->name); 721 721 of_node_put(np); 722 - return -EINVAL; 722 + return err; 723 723 } 724 + group.num_pins = err; 724 725 group.name = prop->value; 725 726 group.pins = devm_kcalloc(dev, group.num_pins, 726 727 sizeof(*(group.pins)), GFP_KERNEL);