Re: [PATCH] HID: wacom: Fix invalid power_supply_powers calls

From: Jiri Kosina
Date: Tue Feb 07 2012 - 07:43:36 EST


On Mon, 6 Feb 2012, przemo@xxxxxxxxx wrote:

> >>>> Hmm, seems valid. How did you notice? Have you seen crashes because of
> >>>> wild pointers?
> >>> Hi Jiri,
> >>> Yes, the driver was unusable - 100% crashes during connection.
> >> Okay, I thought that'd be the case.
> >
> > Very sorry about that. I don't have a device to test with, so I should
> > have reviewed the code extra carefully.
> >
> > Does the same bug apply to the Wii changes, which were of the same form?
> >
> Hi Jeremy,
> The wii code looks the same, so probably it's affected as well. Can you
> make a patch?
>
> power_supply_powers call in wiimote driver:
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/hid/hid-wiimote-core.c#l1229

I have now queued the patch below for the same pile as well.
Thanks for spotting it.


From: Jiri Kosina <jkosina@xxxxxxx>
Subject: [PATCH] HID: wiimote: fix invalid power_supply_powers call

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

Reported-by: przemo@xxxxxxxxx
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
---
drivers/hid/hid-wiimote-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
index fc253b4..cac3589 100644
--- a/drivers/hid/hid-wiimote-core.c
+++ b/drivers/hid/hid-wiimote-core.c
@@ -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;

--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/