diff options
| author | Louis Clinckx <clinckx.louis@gmail.com> | 2026-05-15 14:57:40 +0000 |
|---|---|---|
| committer | Benjamin Tissoires <bentiss@kernel.org> | 2026-05-21 17:12:54 +0200 |
| commit | da7f96a68c39de9eb1c351a261e7fbf716375c91 (patch) | |
| tree | a2ab39e7d2114c2dc7a412d45add729dd874e225 /drivers/hid | |
| parent | 2ee7e632405b022319f42c01635eb6fbbd86414a (diff) | |
| download | linux-next-da7f96a68c39de9eb1c351a261e7fbf716375c91.tar.gz linux-next-da7f96a68c39de9eb1c351a261e7fbf716375c91.zip | |
HID: lenovo-go: drop dead NULL check on to_usb_interface()
to_usb_interface() is a container_of_const() macro: it performs
pointer arithmetic and never returns NULL. The if (!intf) and if
(intf) tests in get_endpoint_address() can never fire. Remove them
in both drivers.
No functional change.
Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Signed-off-by: Louis Clinckx <clinckx.louis@gmail.com>
Reviewed-by: Derek J. Clark <derekjoh.clark@gmail.com>
Tested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Diffstat (limited to 'drivers/hid')
| -rw-r--r-- | drivers/hid/hid-lenovo-go-s.c | 8 | ||||
| -rw-r--r-- | drivers/hid/hid-lenovo-go.c | 3 |
2 files changed, 3 insertions, 8 deletions
diff --git a/drivers/hid/hid-lenovo-go-s.c b/drivers/hid/hid-lenovo-go-s.c index 0444d84498bd..a72f7f748cb5 100644 --- a/drivers/hid/hid-lenovo-go-s.c +++ b/drivers/hid/hid-lenovo-go-s.c @@ -382,11 +382,9 @@ static int get_endpoint_address(struct hid_device *hdev) struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_host_endpoint *ep; - if (intf) { - ep = intf->cur_altsetting->endpoint; - if (ep) - return ep->desc.bEndpointAddress; - } + ep = intf->cur_altsetting->endpoint; + if (ep) + return ep->desc.bEndpointAddress; return -ENODEV; } diff --git a/drivers/hid/hid-lenovo-go.c b/drivers/hid/hid-lenovo-go.c index 3fa1fe83f7e5..e0c9d5ec9451 100644 --- a/drivers/hid/hid-lenovo-go.c +++ b/drivers/hid/hid-lenovo-go.c @@ -641,9 +641,6 @@ static int get_endpoint_address(struct hid_device *hdev) struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_host_endpoint *ep; - if (!intf) - return -ENODEV; - ep = intf->cur_altsetting->endpoint; if (!ep) return -ENODEV; |
