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>
This commit is contained in:
Louis Clinckx 2026-05-15 14:57:40 +00:00 committed by Benjamin Tissoires
parent 2ee7e63240
commit da7f96a68c
2 changed files with 3 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;