diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-08-18 07:39:33 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-08-18 07:39:33 +1000 |
commit | 2867d6b8f96d899153bc7dd030e0644afe816592 (patch) | |
tree | 651304a8fcf25c2482d9be91b0055d3b112b8759 | |
parent | 8a10ceb80b766436ec4cd95bee493672c820fdf8 (diff) | |
download | uGFX-2867d6b8f96d899153bc7dd030e0644afe816592.tar.gz uGFX-2867d6b8f96d899153bc7dd030e0644afe816592.tar.bz2 uGFX-2867d6b8f96d899153bc7dd030e0644afe816592.zip |
Another fix to gdriver
-rw-r--r-- | src/gdriver/gdriver.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gdriver/gdriver.c b/src/gdriver/gdriver.c index c90ad8e3..116abd32 100644 --- a/src/gdriver/gdriver.c +++ b/src/gdriver/gdriver.c @@ -52,13 +52,12 @@ GDriver *gdriverRegister(const GDriverVMT *vmt, void *param) { return 0; } - // Add it to the driver chain - if (dhead) { + // Add it to the driver chain (at the end) + if (dhead) dtail->driverchain = pd; - dtail = pd; - } else { - dhead = dtail = pd; - } + else + dhead = pd; + dtail = pd; // Do the post init if (vmt->postinit) @@ -81,6 +80,8 @@ void gdriverUnRegister(GDriver *driver) { for(pd = dhead; pd->driverchain; pd = pd->driverchain) { if (pd->driverchain == driver) { pd->driverchain = driver->driverchain; + if (!pd->driverchain) + dtail = pd; break; } } |