Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] EISA: handle sysfs errors

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jeff Garzik and committed by
Linus Torvalds
42ddfd68 5e59393e

+17 -5
+17 -5
drivers/eisa/eisa-bus.c
··· 226 226 227 227 static int __init eisa_register_device (struct eisa_device *edev) 228 228 { 229 - if (device_register (&edev->dev)) 230 - return -1; 229 + int rc = device_register (&edev->dev); 230 + if (rc) 231 + return rc; 231 232 232 - device_create_file (&edev->dev, &dev_attr_signature); 233 - device_create_file (&edev->dev, &dev_attr_enabled); 234 - device_create_file (&edev->dev, &dev_attr_modalias); 233 + rc = device_create_file (&edev->dev, &dev_attr_signature); 234 + if (rc) goto err_devreg; 235 + rc = device_create_file (&edev->dev, &dev_attr_enabled); 236 + if (rc) goto err_sig; 237 + rc = device_create_file (&edev->dev, &dev_attr_modalias); 238 + if (rc) goto err_enab; 235 239 236 240 return 0; 241 + 242 + err_enab: 243 + device_remove_file (&edev->dev, &dev_attr_enabled); 244 + err_sig: 245 + device_remove_file (&edev->dev, &dev_attr_signature); 246 + err_devreg: 247 + device_unregister(&edev->dev); 248 + return rc; 237 249 } 238 250 239 251 static int __init eisa_request_resources (struct eisa_root_device *root,