Skip to contentSkip to conversation

tty/tty_io.c: fix compilation warning

PATCH NAK Viresh Kumar 3 participants 3 messages Jan 14, 2011 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty/tty_io.c: fix compilation warning

This patch fixes following compilation warning:
tty/tty_io.c:3309: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result

---
 drivers/tty/tty_io.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/tty/tty_io.c +4 -2
index 464d09d..b558f03 100644
@@ -3291,6 +3291,8 @@ void console_sysfs_notify(void)
  */
 int __init tty_init(void)
 {
+	int ret = 0;
+
 	cdev_init(&tty_cdev, &tty_fops);
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
@@ -3306,11 +3308,11 @@ int __init tty_init(void)
 	if (IS_ERR(consdev))
 		consdev = NULL;
 	else
-		device_create_file(consdev, &dev_attr_active);
+		ret = device_create_file(consdev, &dev_attr_active);
 
 #ifdef CONFIG_VT
 	vty_init(&console_fops);
 #endif
-	return 0;
+	return ret;
 }
 
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 24 lines · Viresh Kumar

This patch fixes following compilation warning:
tty/tty_io.c:3309: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result

---
 drivers/tty/tty_io.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/tty/tty_io.c +2 -0
index 464d09d..b558f03 100644
@@ -3291,6 +3291,8 @@ void console_sysfs_notify(void)
  */
 int __init tty_init(void)
 {
+	int ret = 0;
+
 	cdev_init(&tty_cdev, &tty_fops);
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
@@ -3306,11 +3308,11 @@ int __init tty_init(void)
 	if (IS_ERR(consdev))

drivers/tty/tty_io.c int __init tty_init(void) · line 3316

Quoted 10 lines
drivers/tty/tty_io.c +2 -2
 		consdev = NULL;
 	else
-		device_create_file(consdev, &dev_attr_active);
+		ret = device_create_file(consdev, &dev_attr_active);
 
 #ifdef CONFIG_VT
 	vty_init(&console_fops);
 #endif
-	return 0;
+	return ret;

NACK

There is no failpath handling. And I think Kay has a patch for that already where he ignores the retval.

regards,

Signature · 1 line
js
#2 lore raw
Quoted 38 lines · Jiri Slaby
Quoted 24 lines · Viresh Kumar

This patch fixes following compilation warning:
tty/tty_io.c:3309: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result

---
 drivers/tty/tty_io.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/tty/tty_io.c +2 -0
index 464d09d..b558f03 100644
@@ -3291,6 +3291,8 @@ void console_sysfs_notify(void)
  */
 int __init tty_init(void)
 {
+	int ret = 0;
+
 	cdev_init(&tty_cdev, &tty_fops);
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
@@ -3306,11 +3308,11 @@ int __init tty_init(void)
 	if (IS_ERR(consdev))

drivers/tty/tty_io.c int __init tty_init(void) · line 3316

Quoted 10 lines
drivers/tty/tty_io.c +2 -2
 		consdev = NULL;
 	else
-		device_create_file(consdev, &dev_attr_active);
+		ret = device_create_file(consdev, &dev_attr_active);
 
 #ifdef CONFIG_VT
 	vty_init(&console_fops);
 #endif
-	return 0;
+	return ret;

NACK

Quoted 2 lines

There is no failpath handling. And I think Kay has a patch for that already where he ignores the retval.

Yes, it's in my "to-apply" queue that I will get to when I return to civilization next Wednesday.

thanks,

greg k-h