aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-prodikeys.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-12-09 12:04:19 -0800
committerJakub Kicinski <kuba@kernel.org>2021-12-09 13:23:02 -0800
commit3150a73366b64e3109f0facbc98bcacbc14e81ba (patch)
tree2b94b32c5fe97a4e76058a6f65e8c5717b53ee16 /drivers/hid/hid-prodikeys.c
parentskbuff: Extract list pointers to silence compiler warnings (diff)
parentMerge tag 'net-5.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff)
downloadlinux-dev-3150a73366b64e3109f0facbc98bcacbc14e81ba.tar.xz
linux-dev-3150a73366b64e3109f0facbc98bcacbc14e81ba.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/hid/hid-prodikeys.c')
-rw-r--r--drivers/hid/hid-prodikeys.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 2666af02d5c1..e4e9471d0f1e 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -798,12 +798,18 @@ static int pk_raw_event(struct hid_device *hdev, struct hid_report *report,
static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
- struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
- unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
+ struct usb_interface *intf;
+ unsigned short ifnum;
unsigned long quirks = id->driver_data;
struct pk_device *pk;
struct pcmidi_snd *pm = NULL;
+ if (!hid_is_usb(hdev))
+ return -EINVAL;
+
+ intf = to_usb_interface(hdev->dev.parent);
+ ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
+
pk = kzalloc(sizeof(*pk), GFP_KERNEL);
if (pk == NULL) {
hid_err(hdev, "can't alloc descriptor\n");