From 9ca7d0bf3253fd3858a014fb0f86d5e329feb20a Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Wed, 7 Jan 2015 17:25:09 -0600 Subject: fix cleanup on exit if there is an unknown accessory card ID --- io-module/mts_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3