From f18fbc09223234947b22434b5fa7fd684d17f448 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 17 Feb 2022 18:23:05 -0600 Subject: Unload the driver if platform_driver register fails, add README to explain the history of MTS-IO --- io-module/mts-io.c | 14 ++++++++------ io-module/version.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'io-module') diff --git a/io-module/mts-io.c b/io-module/mts-io.c index db736f9..d65c7ea 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -1347,12 +1347,7 @@ static int __init mts_io_init(void) log_info("init: " DRIVER_VERSION); /* We do a platform_driver_register to do a probe - * of device tree and set the pinctrl. We then - * unregister to remove - * the probe function. If we don't remove the - * probe function, we will do a 2nd probe in - * platform_device_add, which will result in a - * stack trace in the log. */ + * of device tree and set the pinctrl/gpio settings. */ ret = platform_driver_register(&mts_io_driver); if (ret) { printk(KERN_ERR "mts-io: probe failed: %d\n", ret); @@ -1360,6 +1355,13 @@ static int __init mts_io_init(void) return ret; } + /* Without a platform device our EEPROM load will + * not work, and we cannot continue. */ + if (mts_io_platform_device == NULL) { + pr_err("mts-io: probe failed, possible bad device tree\n"); + return -ENODEV; + } + /* request_firmware() requires a device, so call after device allocated */ ret = mts_id_eeprom_load(); diff --git a/io-module/version.h b/io-module/version.h index a97e7df..b72c4b0 100644 --- a/io-module/version.h +++ b/io-module/version.h @@ -1,7 +1,7 @@ #ifndef __VERSION_H #define __VERSION_H -#define DRIVER_VERSION "v4.9.0" +#define DRIVER_VERSION "v4.9.1" #define DRIVER_AUTHOR "Multitech Systems" #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" -- cgit v1.2.3