Skip to contentSkip to conversation

linux-next: build warning after merge of the tty tree

PATCH In review Stephen Rothwell 3 participants 3 messages Sep 19, 2018 – Sep 20, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

After merging the tty tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/tty/serial/kgdboc.c:134:12: warning: 'kgdboc_option_setup' defined but not used [-Wunused-function]
static int kgdboc_option_setup(char *opt)

            ^~~~~~~~~~~~~~~~~~~

Introduced by commit

2dd453168643 ("kgdboc: Fix restrict error")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw

PATCH 1/1 kgdboc: Fix warning with module build

After 2dd453168643 ("kgdboc: Fix restrict error"), kgdboc_option_setup is now only used when built in, resulting in a warning when compiled as a module:

drivers/tty/serial/kgdboc.c:134:12: warning: 'kgdboc_option_setup' defined but not used [-Wunused-function]
static int kgdboc_option_setup(char *opt)

            ^~~~~~~~~~~~~~~~~~~

Move the function under the appropriate ifdef for builtin only.

Fixes 2dd453168643 ("kgdboc: Fix restrict error")
---
 drivers/tty/serial/kgdboc.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)
drivers/tty/serial/kgdboc.c +19 -18
index e9a83bb5bee5..baeeeaec3f03 100644
@@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void)
 #define kgdboc_restore_input()
 #endif /* ! CONFIG_KDB_KEYBOARD */
 
-static int kgdboc_option_setup(char *opt)
-{
-	if (!opt) {
-		pr_err("config string not provided\n");
-		return -EINVAL;
-	}
-
-	if (strlen(opt) >= MAX_CONFIG_LEN) {
-		pr_err("config string too long\n");
-		return -ENOSPC;
-	}
-	strcpy(config, opt);
-
-	return 0;
-}
-
-__setup("kgdboc=", kgdboc_option_setup);
-
 static void cleanup_kgdboc(void)
 {
 	if (kgdb_unregister_nmi_console())
@@ -316,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = {
 };
 
 #ifdef CONFIG_KGDB_SERIAL_CONSOLE
+static int kgdboc_option_setup(char *opt)
+{
+	if (!opt) {
+		pr_err("config string not provided\n");
+		return -EINVAL;
+	}
+
+	if (strlen(opt) >= MAX_CONFIG_LEN) {
+		pr_err("config string too long\n");
+		return -ENOSPC;
+	}
+	strcpy(config, opt);
+
+	return 0;
+}
+
+__setup("kgdboc=", kgdboc_option_setup);
+
+
 /* This is only available if kgdboc is a built in for early debugging */
 static int __init kgdboc_early_init(char *opt)
 {
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH] kgdboc: Fix warning with module build

Quoted 9 lines · Laura Abbott

After 2dd453168643 ("kgdboc: Fix restrict error"), kgdboc_option_setup is now only used when built in, resulting in a warning when compiled as a module:

drivers/tty/serial/kgdboc.c:134:12: warning: 'kgdboc_option_setup' defined but not used [-Wunused-function]
static int kgdboc_option_setup(char *opt)

            ^~~~~~~~~~~~~~~~~~~
Quoted 7 lines

Move the function under the appropriate ifdef for builtin only.

Fixes 2dd453168643 ("kgdboc: Fix restrict error")
---
 drivers/tty/serial/kgdboc.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

You forgot a reported-by: tag :(

I'll go fix it up, thanks for the patch resolving this.

greg k-h