When try_module_get fails, the lack of error-handling code may cause unexpected results.
This patch adds error-handling code after calling try_module_get. Signed-off-by: Zhouyang Jia <jiazhouyan...@gmail.com> --- drivers/tty/serial/kgdboc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c index b4ba2b1..641e22a 100644 --- a/drivers/tty/serial/kgdboc.c +++ b/drivers/tty/serial/kgdboc.c @@ -286,8 +286,10 @@ static void kgdboc_pre_exp_handler(void) con_debug_enter(vc_cons[fg_console].d); } /* Increment the module count when the debugger is active */ - if (!kgdb_connected) - try_module_get(THIS_MODULE); + if (!kgdb_connected) { + if (!try_module_get(THIS_MODULE)) + printk(KERN_ERR "kgdboc: cannot get module.\n"); + } } static void kgdboc_post_exp_handler(void) -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport