mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
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:
parent
2ee7e63240
commit
da7f96a68c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user