Browse Source

regulator: prevent registration of matching regulator consumer supplies

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Pointer comparison is not sufficient for non-NULL device name matching,
so use strcmp(). Otherwise the semantics remain the same.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Jani Nikula 15 years ago
parent
commit
23b5cc2ab6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      drivers/regulator/core.c

+ 6 - 1
drivers/regulator/core.c

@@ -944,8 +944,13 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 		has_dev = 0;
 		has_dev = 0;
 
 
 	list_for_each_entry(node, &regulator_map_list, list) {
 	list_for_each_entry(node, &regulator_map_list, list) {
-		if (consumer_dev_name != node->dev_name)
+		if (node->dev_name && consumer_dev_name) {
+			if (strcmp(node->dev_name, consumer_dev_name) != 0)
+				continue;
+		} else if (node->dev_name || consumer_dev_name) {
 			continue;
 			continue;
+		}
+
 		if (strcmp(node->supply, supply) != 0)
 		if (strcmp(node->supply, supply) != 0)
 			continue;
 			continue;