summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2015-01-07 17:25:09 -0600
committerJesse Gilles <jgilles@multitech.com>2015-01-07 17:25:09 -0600
commit9ca7d0bf3253fd3858a014fb0f86d5e329feb20a (patch)
tree4fcdb52c14291a3fc16f50066d2270b7aff06852
parente78a48c5bfc3ea70e12d6499e15e6746d2c003aa (diff)
downloadmts-io-9ca7d0bf3253fd3858a014fb0f86d5e329feb20a.tar.gz
mts-io-9ca7d0bf3253fd3858a014fb0f86d5e329feb20a.tar.bz2
mts-io-9ca7d0bf3253fd3858a014fb0f86d5e329feb20a.zip
fix cleanup on exit if there is an unknown accessory card ID
-rw-r--r--io-module/mts_io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index cd39f99..b3c3a10 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -408,6 +408,8 @@ static bool load_port(int port) {
}
} else {
log_error("unknown accessory card [%s] in port %d", ap_eeprom[port_index].product_id, port);
+ kfree(port_info[port_index]);
+ port_info[port_index] = NULL;
return false;
}
@@ -429,7 +431,8 @@ static bool load_port(int port) {
if (! port_info[port_index]->setup(port)) {
log_error("accessory port %d setup failed", port);
port_info[port_index]->teardown(port);
- kfree(port_info[port]);
+ kfree(port_info[port_index]);
+ port_info[port_index] = NULL;
return false;
}
}