Commit 95751f19 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Greg Kroah-Hartman
Browse files

staging: ks7010: Replace mdelay with usleep_range in ks7010_upload_firmware



ks7010_upload_firmware() is never called in atomic context.

The call chain ending up at ks7010_upload_firmware() is:
[1] ks7010_upload_firmware() <- ks7010_sdio_probe()

ks7010_sdio_probe() is set as ".probe" in struct sdio_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, ks7010_upload_firmware()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() 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: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47bda74a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -725,7 +725,7 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card)

	/* Firmware running check */
	for (n = 0; n < 50; ++n) {
		mdelay(10);	/* wait_ms(10); */
		usleep_range(10000, 11000);	/* wait_ms(10); */
		ret = ks7010_sdio_readb(priv, GCR_A, &byte);
		if (ret)
			goto release_firmware;