+ fbcon-honor-the-return-value-of-device_create_file.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     fbcon: Honor the return value of device_create_file

has been added to the -mm tree.  Its filename is

     fbcon-honor-the-return-value-of-device_create_file.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: fbcon: Honor the return value of device_create_file
From: "Antonino A. Daplas" <adaplas@xxxxxxxxx>

Check the return value of device_create_file().  If return is 'fail', remove
attributes by calling device_remove_file().

Signed-off-by: Antonino Daplas <adaplas@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/video/console/fbcon.c |   34 +++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff -puN drivers/video/console/fbcon.c~fbcon-honor-the-return-value-of-device_create_file drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c~fbcon-honor-the-return-value-of-device_create_file
+++ a/drivers/video/console/fbcon.c
@@ -133,6 +133,7 @@ static int info_idx = -1;
 
 /* console rotation */
 static int rotate;
+static int fbcon_has_sysfs;
 
 static const struct consw fb_con;
 
@@ -3166,11 +3167,26 @@ static struct class_device_attribute cla
 
 static int fbcon_init_class_device(void)
 {
-	int i;
+	int i, error = 0;
+
+	fbcon_has_sysfs = 1;
+
+	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
+		error = class_device_create_file(fbcon_class_device,
+						 &class_device_attrs[i]);
+
+		if (error)
+			break;
+	}
+
+	if (error) {
+		while (--i >= 0)
+			class_device_remove_file(fbcon_class_device,
+						 &class_device_attrs[i]);
+
+		fbcon_has_sysfs = 0;
+	}
 
-	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_create_file(fbcon_class_device,
-					 &class_device_attrs[i]);
 	return 0;
 }
 
@@ -3279,9 +3295,13 @@ static void __exit fbcon_deinit_class_de
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_remove_file(fbcon_class_device,
-					 &class_device_attrs[i]);
+	if (fbcon_has_sysfs) {
+		for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
+			class_device_remove_file(fbcon_class_device,
+						 &class_device_attrs[i]);
+
+		fbcon_has_sysfs = 0;
+	}
 }
 
 static void __exit fb_console_exit(void)
_

Patches currently in -mm which might be from adaplas@xxxxxxxxx are

nvidiafb-use-generic-ddc-reading.patch
rivafb-use-generic-ddc-reading.patch
i810fb-use-generic-ddc-reading.patch
savagefb-use-generic-ddc-reading.patch
fbcon-remove-cursor-timer-if-unused.patch
vt-honor-the-return-value-of-device_create_file.patch
fbdev-honor-the-return-value-of-device_create_file.patch
fbcon-honor-the-return-value-of-device_create_file.patch
atyfb-honor-the-return-value-of-pci_register_driver.patch
matroxfb-honor-the-return-value-of-pci_register_driver.patch
nvidiafb-honor-the-return-value-of-pci_enable_device.patch
i810fb-honor-the-return-value-of-pci_enable_device.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux