diff --git a/samples/subsys/usb/mass/src/main.c b/samples/subsys/usb/mass/src/main.c index eec6920fcad..305ed55b4d2 100644 --- a/samples/subsys/usb/mass/src/main.c +++ b/samples/subsys/usb/mass/src/main.c @@ -45,18 +45,8 @@ static struct fs_mount_t fs_mnt = { #endif /* file system */ #endif /* CONFIG_DISK_ACCESS_FLASH */ -void main(void) +static void setup_disk(void) { - int ret; - - ret = usb_enable(NULL); - if (ret != 0) { - LOG_ERR("Failed to enable USB"); - return; - } - - LOG_INF("The device is put in USB mass storage mode.\n"); - #if CONFIG_DISK_ACCESS_FLASH struct fs_mount_t *mp = &fs_mnt; unsigned int id = (uintptr_t)mp->storage_dev; @@ -125,3 +115,18 @@ out: flash_area_close(pfa); #endif } + +void main(void) +{ + int ret; + + setup_disk(); + + ret = usb_enable(NULL); + if (ret != 0) { + LOG_ERR("Failed to enable USB"); + return; + } + + LOG_INF("The device is put in USB mass storage mode.\n"); +}