[RFC PATCH 02/11] regulator: Fix error check in set_consumer_device_supply

Rajendra Nayak rnayak at ti.com
Thu Sep 15 21:21:58 EST 2011


The parameters to set_consumer_device_supply() can be considered
invalid (and hence it could return -EINVAL) if nether consumer_dev nor
consumer_dev_name are passed, not when *both* are passed.

Signed-off-by: Rajendra Nayak <rnayak at ti.com>
---
 drivers/regulator/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d8e6a42..9365359 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -981,7 +981,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 	struct regulator_map *node;
 	int has_dev;
 
-	if (consumer_dev && consumer_dev_name)
+	if (!consumer_dev && !consumer_dev_name)
 		return -EINVAL;
 
 	if (!consumer_dev_name && consumer_dev)
-- 
1.7.1



More information about the devicetree-discuss mailing list