]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/hid/hid-zydacron.c
staging: line6: add bounds check in snd_toneport_source_put()
[karo-tx-linux.git] / drivers / hid / hid-zydacron.c
index e4cddeccd6b51691bffc955a62569ead5e6d480e..1a660bd97ab2118f092403c71e237f620f6671ff 100644 (file)
@@ -169,7 +169,7 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
        int ret;
        struct zc_device *zc;
 
-       zc = kzalloc(sizeof(*zc), GFP_KERNEL);
+       zc = devm_kzalloc(&hdev->dev, sizeof(*zc), GFP_KERNEL);
        if (zc == NULL) {
                hid_err(hdev, "can't alloc descriptor\n");
                return -ENOMEM;
@@ -180,28 +180,16 @@ static int zc_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;
        }
 
        ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
        if (ret) {
                hid_err(hdev, "hw start failed\n");
-               goto err_free;
+               return ret;
        }
 
        return 0;
-err_free:
-       kfree(zc);
-
-       return ret;
-}
-
-static void zc_remove(struct hid_device *hdev)
-{
-       struct zc_device *zc = hid_get_drvdata(hdev);
-
-       hid_hw_stop(hdev);
-       kfree(zc);
 }
 
 static const struct hid_device_id zc_devices[] = {
@@ -217,7 +205,6 @@ static struct hid_driver zc_driver = {
        .input_mapping = zc_input_mapping,
        .raw_event = zc_raw_event,
        .probe = zc_probe,
-       .remove = zc_remove,
 };
 module_hid_driver(zc_driver);