diff options
author | Amir Hammad <amir.hammad@hotmail.com> | 2015-07-13 16:16:39 +0200 |
---|---|---|
committer | Amir Hammad <amir.hammad@hotmail.com> | 2015-07-13 16:16:39 +0200 |
commit | 3003006216579428ee255073743321390400a8dc (patch) | |
tree | d8e9207762622bd1d063b9449990324b7b869e75 | |
parent | 33856ce17ccc2a4c1041d456f6d9c86eed4b1105 (diff) | |
download | secure-hid-3003006216579428ee255073743321390400a8dc.tar.gz secure-hid-3003006216579428ee255073743321390400a8dc.tar.bz2 secure-hid-3003006216579428ee255073743321390400a8dc.zip |
hub: Do not allow unitialized driver to be loaded
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
-rw-r--r-- | src/usbh_driver_hub.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c index 266cd71..7678dd7 100644 --- a/src/usbh_driver_hub.c +++ b/src/usbh_driver_hub.c @@ -31,12 +31,14 @@ static hub_device_t hub_device[USBH_MAX_HUBS];
static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data);
-
+static bool initialized = false;
void hub_driver_init(void)
{
uint32_t i;
+ initialized = true;
+
for (i = 0; i < USBH_MAX_HUBS; i++) {
hub_device[i].device[0] = 0;
hub_device[i].ports_num = 0;
@@ -51,6 +53,11 @@ void hub_driver_init(void) */
static void *init(void *usbh_dev)
{
+ if (!initialized) {
+ LOG_PRINTF("\n%s/%d : driver not initialized\r\n", __FILE__, __LINE__);
+ return 0;
+ }
+
uint32_t i;
hub_device_t *drvdata = 0;
// find free data space for hub device
|