Skip to contentSkip to conversation

regulator: core: Fix argument to _notifier_call_chain call

PATCH In review Axel Lin 2 participants 2 messages Jul 29, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: core: Fix argument to _notifier_call_chain call

Pass the address of best_val rather than the value of best_val for the third argument to _notifier_call_chain().

This fixes below build warning:
CC drivers/regulator/core.o
drivers/regulator/core.c: In function '_regulator_do_set_voltage':
drivers/regulator/core.c:2183:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

---
 drivers/regulator/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
index f092588..37ce62b 100644
@@ -2180,7 +2180,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 
 	if (ret == 0 && best_val >= 0)
 		_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
-				     (void *)best_val);
+				     (void *)&best_val);
 
 	trace_regulator_set_voltage_complete(rdev_get_name(rdev), best_val);
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 7 lines · Axel Lin

Pass the address of best_val rather than the value of best_val for the third argument to _notifier_call_chain().

This fixes below build warning:
CC drivers/regulator/core.o
drivers/regulator/core.c: In function '_regulator_do_set_voltage':
drivers/regulator/core.c:2183:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

No, this isn't a good idea - you're fixing a warning by changing the semantics to be something obscure and not terribly helpful. Just add a cast if your compiler is getting upset.