usb: core: Remove unnecessary memset()
PATCH 1/1 usb: core: Remove unnecessary memset()
register_root_hub() calls memset() setting usb_dev->bus->devmap. devicemap to 0 during hcd probe function (usb_hcd_pci_probe). But in previous function which is also the procedure of usb_hcd_pci_probe(), usb_bus_init() already initialized bus->devmap calling memset(). Furthermore, register_root_hub() is called only once in kernel. So, calling memset() which resets usb_bus->devmap.devicemap in register_root_hub() is redundant.
--- drivers/usb/core/hcd.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/core/hcd.c +0 -2
@@ -1074,8 +1074,6 @@ static int register_root_hub(struct usb_hcd *hcd) usb_dev->devnum = devnum; usb_dev->bus->devnum_next = devnum +1 ; -memset (&usb_dev->bus->devmap.devicemap,0 , -sizeof usb_dev->bus->devmap.devicemap);set_bit (devnum, usb_dev->bus->devmap.devicemap);usb_set_device_state (usb_dev,USB_STATE_ADDRESS );
Quoted 18 lines · Suwan Kim
register_root_hub()callsmemset()settingusb_dev->bus->devmap. devicemap to 0 during hcd probe function (usb_hcd_pci_probe). But in previous function which is also the procedure ofusb_hcd_pci_probe(),usb_bus_init()already initializedbus->devmapcallingmemset(). Furthermore,register_root_hub()is called only once in kernel. So, callingmemset()which resetsusb_bus->devmap.devicemapinregister_root_hub()is redundant.Signed-off-by Suwan Kim <[email protected]>--- drivers/usb/core/hcd.c | 2 -- 1 file changed, 2 deletions(-)drivers/usb/core/hcd.c +0
-0
drivers/usb/core/hcd.c static int register_root_hub(struct usb_hcd *hcd) · line 1078
Quoted 7 lines
drivers/usb/core/hcd.c +0
-2@@ -1074,8 +1074,6 @@ static int register_root_hub(struct usb_hcd *hcd) usb_dev->devnum = devnum; usb_dev->bus->devnum_next = devnum +1 ; -memset (&usb_dev->bus->devmap.devicemap,0 , -sizeof usb_dev->bus->devmap.devicemap);set_bit (devnum, usb_dev->bus->devmap.devicemap);usb_set_device_state (usb_dev,USB_STATE_ADDRESS );