Re: [PATCH 06/18] software_node: amend software_node_unregister_node_group() to perform unregistration of array in reverse order to be consistent with software_node_unregister_nodes()

Dan Carpenter
2020-12-01T18:19:31Z

[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]

Hi Daniel,

url: https://github.com/0day-ci/linux/commits/Daniel-Scally/Add-functionality-to-ipu3-cio2-driver-allowing-software_node-connections-to-sensors-on-platforms-designed-for-Windows/20201130-214014
base: git://linuxtv.org/media_tree.git master
config: i386-randconfig-m021-20201130 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/base/swnode.c:785 software_node_unregister_node_group() error: uninitialized symbol 'i'.

vim +/i +785 drivers/base/swnode.c

02094d54870590a Andy Shevchenko 2020-04-08 778 void software_node_unregister_node_group(const struct software_node **node_group)
02094d54870590a Andy Shevchenko 2020-04-08 779 {
02094d54870590a Andy Shevchenko 2020-04-08 780 unsigned int i;
02094d54870590a Andy Shevchenko 2020-04-08 781
02094d54870590a Andy Shevchenko 2020-04-08 782 if (!node_group)
02094d54870590a Andy Shevchenko 2020-04-08 783 return;
02094d54870590a Andy Shevchenko 2020-04-08 784
7c7577c82672f0a Daniel Scally 2020-11-30 @785 while (node_group[i]->name)
^
The "i" is never initialized.

7c7577c82672f0a Daniel Scally 2020-11-30 786 i++;
7c7577c82672f0a Daniel Scally 2020-11-30 787
7c7577c82672f0a Daniel Scally 2020-11-30 788 while (i--)
9dcbac84244f32e Andy Shevchenko 2020-06-22 789 software_node_unregister(node_group[i]);

It's a strange thing that they can only be unregistered in reverse
order... Walter Harms is right when he points out that programmers are
notoriously bad at counting backwards.

02094d54870590a Andy Shevchenko 2020-04-08 790 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32286 bytes --]