Patchwork [2/2] HID: wiimote: fix invalid power_supply_powers call

login
register
mail settings
Submitter Luis Henriques
Date Sept. 11, 2012, 2:15 p.m.
Message ID <1347372938-30806-3-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/183122/
State New
Headers show

Comments

Luis Henriques - Sept. 11, 2012, 2:15 p.m.
From: Jiri Kosina <jkosina@suse.cz>

BugLink: http://bugs.launchpad.net/bugs/1048605

Analogically to d7cb3dbd1 ("HID: wacom: Fix invalid power_supply_powers
calls"), fix also the same occurence in wiimote driver.

Reported-by: przemo@firszt.eu
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
(cherry picked from commit 217c8b2b1978aa4a02ce040a99c59ed3b6418fe5)

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-wiimote.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c
index 295901e..febcd9b 100644
--- a/drivers/hid/hid-wiimote.c
+++ b/drivers/hid/hid-wiimote.c
@@ -1251,14 +1251,14 @@  static int wiimote_hid_probe(struct hid_device *hdev,
 	wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
 	wdata->battery.use_for_apm = 0;
 
-	power_supply_powers(&wdata->battery, &hdev->dev);
-
 	ret = power_supply_register(&wdata->hdev->dev, &wdata->battery);
 	if (ret) {
 		hid_err(hdev, "Cannot register battery device\n");
 		goto err_battery;
 	}
 
+	power_supply_powers(&wdata->battery, &hdev->dev);
+
 	ret = wiimote_leds_create(wdata);
 	if (ret)
 		goto err_free;