Skip to content

Commit

Permalink
usb: isp1760: Replace mdelay with msleep in isp1760_stop
Browse files Browse the repository at this point in the history
isp1760_stop() is never called in atomic context.

The call chain ending up at isp1760_stop() is:
[1] isp1760_stop() <- isp1760_shutdown()

isp1760_shutdown() is set as ".shutdown" in struct hc_driver.
isp1760_stop() is also set as ".stop" in hc_driver.
These functions are not called in atomic context.

Despite never getting called from atomic context, isp1760_stop()
calls mdelay() to busily wait.
This is not necessary and can be replaced with msleep() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jia-Ju Bai authored and Greg Kroah-Hartman committed Apr 22, 2018
1 parent 0f02900 commit de0611b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/isp1760/isp1760-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ static void isp1760_stop(struct usb_hcd *hcd)

isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1,
NULL, 0);
mdelay(20);
msleep(20);

spin_lock_irq(&priv->lock);
ehci_reset(hcd);
Expand Down

0 comments on commit de0611b

Please sign in to comment.