Skip to content

Commit 910a7e8

Browse files
lucastanureJiri Kosina
authored andcommitted
HID: appleir: Use devm_kzalloc() instead of kzalloc()
Signed-off-by: Lucas Tanure <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b08e8d8 commit 910a7e8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/hid/hid-appleir.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
283283
int ret;
284284
struct appleir *appleir;
285285

286-
appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL);
286+
appleir = devm_kzalloc(&hid->dev, sizeof(struct appleir), GFP_KERNEL);
287287
if (!appleir)
288288
return -ENOMEM;
289289

@@ -311,7 +311,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
311311

312312
return 0;
313313
fail:
314-
kfree(appleir);
314+
devm_kfree(&hid->dev, appleir);
315315
return ret;
316316
}
317317

@@ -320,7 +320,6 @@ static void appleir_remove(struct hid_device *hid)
320320
struct appleir *appleir = hid_get_drvdata(hid);
321321
hid_hw_stop(hid);
322322
del_timer_sync(&appleir->key_up_timer);
323-
kfree(appleir);
324323
}
325324

326325
static const struct hid_device_id appleir_devices[] = {

0 commit comments

Comments
 (0)