HID: wiimote: fix invalid power_supply_powers call
authorJiri Kosina <jkosina@suse.cz>
Tue, 7 Feb 2012 12:40:56 +0000 (13:40 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 7 Feb 2012 12:40:56 +0000 (13:40 +0100)
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>
drivers/hid/hid-wiimote-core.c

index fc253b472f9d4033922693aa980d947210b1d4c2..cac3589b1ed5ac192455b804db0ea321d603ec8a 100644 (file)
@@ -1226,14 +1226,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;