HID: sony: Prevent the freeing of an unitialized ida value
sony_allocate_output_report() was being called before sony_set_device_id() which meant that an unallocated ida value was was freed if the output report allocation failed and the probe function jumped to err_stop. Do the device ID allocation before the output report allocation to avoid freeing an unallocated value in case of a failure. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
8de29a35dc
commit
131a8a9a56
|
@ -1993,18 +1993,18 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = sony_allocate_output_report(sc);
|
||||
if (ret < 0) {
|
||||
hid_err(hdev, "failed to allocate the output report buffer\n");
|
||||
goto err_stop;
|
||||
}
|
||||
|
||||
ret = sony_set_device_id(sc);
|
||||
if (ret < 0) {
|
||||
hid_err(hdev, "failed to allocate the device id\n");
|
||||
goto err_stop;
|
||||
}
|
||||
|
||||
ret = sony_allocate_output_report(sc);
|
||||
if (ret < 0) {
|
||||
hid_err(hdev, "failed to allocate the output report buffer\n");
|
||||
goto err_stop;
|
||||
}
|
||||
|
||||
if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
|
||||
/*
|
||||
* The Sony Sixaxis does not handle HID Output Reports on the
|
||||
|
|
Loading…
Reference in a new issue