X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=blobdiff_plain;f=drivers%2Fhid%2Fhid-sony.c;h=30dbb6b40bbf17e93c63b2bd6d3eb3b7f8111593;hp=ecbc74923d063d6494aaa4648f08d91a6c44e686;hb=63faf15dba4a7d6fb18ed5c45670a152d0c5330b;hpb=ddf7540e9c3a3d65739daa339c8838fa39cf2758 diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index ecbc74923d06..30dbb6b40bbf 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -369,7 +369,8 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi, if (sc->quirks & PS3REMOTE) return ps3remote_mapping(hdev, hi, field, usage, bit, max); - return -1; + /* Let hid-core decide for the others */ + return 0; } /* @@ -623,7 +624,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) struct sony_sc *sc; unsigned int connect_mask = HID_CONNECT_DEFAULT; - sc = kzalloc(sizeof(*sc), GFP_KERNEL); + sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); return -ENOMEM; @@ -635,7 +636,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); - goto err_free; + return ret; } if (sc->quirks & VAIO_RDESC_CONSTANT) @@ -648,7 +649,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ret = hid_hw_start(hdev, connect_mask); if (ret) { hid_err(hdev, "hw start failed\n"); - goto err_free; + return ret; } if (sc->quirks & SIXAXIS_CONTROLLER_USB) { @@ -668,8 +669,6 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) return 0; err_stop: hid_hw_stop(hdev); -err_free: - kfree(sc); return ret; } @@ -681,7 +680,6 @@ static void sony_remove(struct hid_device *hdev) buzz_remove(hdev); hid_hw_stop(hdev); - kfree(sc); } static const struct hid_device_id sony_devices[] = {