aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console/fbcon.c
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-10-03 04:14:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:10 -0400
commit0a727dea774c47ad1e18907be33f12c9f325ee4a (patch)
tree77065559c6448f9c271899da008aa55428459480 /drivers/video/console/fbcon.c
parent1a6600be3e5dafe2ddcc5d969d931c2591eed896 (diff)
[PATCH] fbcon: Honor the return value of device_create_file
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@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/console/fbcon.c')
-rw-r--r--drivers/video/console/fbcon.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 9e3ff00e4c14..8c041daa3a15 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -133,6 +133,7 @@ static int info_idx = -1;
133 133
134/* console rotation */ 134/* console rotation */
135static int rotate; 135static int rotate;
136static int fbcon_has_sysfs;
136 137
137static const struct consw fb_con; 138static const struct consw fb_con;
138 139
@@ -3166,11 +3167,26 @@ static struct class_device_attribute class_device_attrs[] = {
3166 3167
3167static int fbcon_init_class_device(void) 3168static int fbcon_init_class_device(void)
3168{ 3169{
3169 int i; 3170 int i, error = 0;
3171
3172 fbcon_has_sysfs = 1;
3173
3174 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
3175 error = class_device_create_file(fbcon_class_device,
3176 &class_device_attrs[i]);
3177
3178 if (error)
3179 break;
3180 }
3181
3182 if (error) {
3183 while (--i >= 0)
3184 class_device_remove_file(fbcon_class_device,
3185 &class_device_attrs[i]);
3186
3187 fbcon_has_sysfs = 0;
3188 }
3170 3189
3171 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3172 class_device_create_file(fbcon_class_device,
3173 &class_device_attrs[i]);
3174 return 0; 3190 return 0;
3175} 3191}
3176 3192
@@ -3279,9 +3295,13 @@ static void __exit fbcon_deinit_class_device(void)
3279{ 3295{
3280 int i; 3296 int i;
3281 3297
3282 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 3298 if (fbcon_has_sysfs) {
3283 class_device_remove_file(fbcon_class_device, 3299 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3284 &class_device_attrs[i]); 3300 class_device_remove_file(fbcon_class_device,
3301 &class_device_attrs[i]);
3302
3303 fbcon_has_sysfs = 0;
3304 }
3285} 3305}
3286 3306
3287static void __exit fb_console_exit(void) 3307static void __exit fb_console_exit(void)