diff options
author | Mike Fiore <mfiore@multitech.com> | 2014-10-28 17:49:51 -0500 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2014-10-28 17:49:51 -0500 |
commit | e2b1a4fe8e513726a6df8325d6bdc0d26b647639 (patch) | |
tree | 03c28ce0660fe30e7a2b77f2cfea3b35c369298a /io-module/mts_io.c | |
parent | 3d8cfe72152acb9ac6237b2b4840c3421571cd9a (diff) | |
download | mts-io-e2b1a4fe8e513726a6df8325d6bdc0d26b647639.tar.gz mts-io-e2b1a4fe8e513726a6df8325d6bdc0d26b647639.tar.bz2 mts-io-e2b1a4fe8e513726a6df8325d6bdc0d26b647639.zip |
mts-io: fix bug where cleanup() crashes if eeprom is empty
make sure mts_io_platform_device is valid before dereferencing it
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r-- | io-module/mts_io.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 2d60a6d..cbf0637 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -507,8 +507,10 @@ static void cleanup(void) int port_index; log_info("cleaning up...."); - sysfs_remove_link(&mts_io_platform_device->dev.parent->kobj, "mtcdp"); - platform_device_unregister(mts_io_platform_device); + if (mts_io_platform_device) { + sysfs_remove_link(&mts_io_platform_device->dev.parent->kobj, "mtcdp"); + platform_device_unregister(mts_io_platform_device); + } for (port_index = 0, port = 1; port_index < NUM_AP; port_index++, port++) { if (port_info[port_index]) { port_info[port_index]->teardown(port); |