HID: intel-ish-hid: fixes incorrect error handling
authorPan Bian <bianpan2016@163.com>
Thu, 22 Nov 2018 00:52:33 +0000 (08:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:34:28 +0000 (15:34 +0100)
[ Upstream commit 6e0856d317440a950b17c00a9283114f025e5699 ]

The memory chunk allocated by hid_allocate_device() should be released
by hid_destroy_device(), not kfree().

Fixes: 0b28cb4bcb1("HID: intel-ish-hid: ISH HID client driver")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/intel-ish-hid/ishtp-hid.c

index 277983aa1d90a31c607105308c8047a62a747a0e..d0b902285fc3ae6142ced9138f7a04f90058d744 100644 (file)
@@ -222,7 +222,7 @@ int ishtp_hid_probe(unsigned int cur_hid_dev,
 err_hid_device:
        kfree(hid_data);
 err_hid_data:
-       kfree(hid);
+       hid_destroy_device(hid);
        return rv;
 }