From: Jani Nikula Date: Thu, 29 Apr 2010 07:55:09 +0000 (+0300) Subject: regulator: prevent registration of matching regulator consumer supplies X-Git-Tag: firefly_0821_release~9833^2~1882^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=23b5cc2ab6783256cf06779e1d522482b819b808;p=firefly-linux-kernel-4.4.55.git regulator: prevent registration of matching regulator consumer supplies Acked-by: Mark Brown 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 Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index eb112d961515..2a3494f72465 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -944,8 +944,13 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, has_dev = 0; list_for_each_entry(node, ®ulator_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; + } + if (strcmp(node->supply, supply) != 0) continue;