diff options
Diffstat (limited to 'drivers/hid/hid-zydacron.c')
-rw-r--r-- | drivers/hid/hid-zydacron.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/hid/hid-zydacron.c b/drivers/hid/hid-zydacron.c index e4cddeccd6b5..1a660bd97ab2 100644 --- a/drivers/hid/hid-zydacron.c +++ b/drivers/hid/hid-zydacron.c | |||
@@ -169,7 +169,7 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
169 | int ret; | 169 | int ret; |
170 | struct zc_device *zc; | 170 | struct zc_device *zc; |
171 | 171 | ||
172 | zc = kzalloc(sizeof(*zc), GFP_KERNEL); | 172 | zc = devm_kzalloc(&hdev->dev, sizeof(*zc), GFP_KERNEL); |
173 | if (zc == NULL) { | 173 | if (zc == NULL) { |
174 | hid_err(hdev, "can't alloc descriptor\n"); | 174 | hid_err(hdev, "can't alloc descriptor\n"); |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
@@ -180,28 +180,16 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
180 | ret = hid_parse(hdev); | 180 | ret = hid_parse(hdev); |
181 | if (ret) { | 181 | if (ret) { |
182 | hid_err(hdev, "parse failed\n"); | 182 | hid_err(hdev, "parse failed\n"); |
183 | goto err_free; | 183 | return ret; |
184 | } | 184 | } |
185 | 185 | ||
186 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 186 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
187 | if (ret) { | 187 | if (ret) { |
188 | hid_err(hdev, "hw start failed\n"); | 188 | hid_err(hdev, "hw start failed\n"); |
189 | goto err_free; | 189 | return ret; |
190 | } | 190 | } |
191 | 191 | ||
192 | return 0; | 192 | return 0; |
193 | err_free: | ||
194 | kfree(zc); | ||
195 | |||
196 | return ret; | ||
197 | } | ||
198 | |||
199 | static void zc_remove(struct hid_device *hdev) | ||
200 | { | ||
201 | struct zc_device *zc = hid_get_drvdata(hdev); | ||
202 | |||
203 | hid_hw_stop(hdev); | ||
204 | kfree(zc); | ||
205 | } | 193 | } |
206 | 194 | ||
207 | static const struct hid_device_id zc_devices[] = { | 195 | static const struct hid_device_id zc_devices[] = { |
@@ -217,7 +205,6 @@ static struct hid_driver zc_driver = { | |||
217 | .input_mapping = zc_input_mapping, | 205 | .input_mapping = zc_input_mapping, |
218 | .raw_event = zc_raw_event, | 206 | .raw_event = zc_raw_event, |
219 | .probe = zc_probe, | 207 | .probe = zc_probe, |
220 | .remove = zc_remove, | ||
221 | }; | 208 | }; |
222 | module_hid_driver(zc_driver); | 209 | module_hid_driver(zc_driver); |
223 | 210 | ||