Skip to content

Commit 42ddfd6

Browse files
Jeff GarzikLinus Torvalds
authored andcommitted
[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>
1 parent 5e59393 commit 42ddfd6

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

‎drivers/eisa/eisa-bus.c‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,26 @@ static int __init eisa_init_device (struct eisa_root_device *root,
226226

227227
static int __init eisa_register_device (struct eisa_device *edev)
228228
{
229-
if (device_register (&edev->dev))
230-
return -1;
229+
int rc = device_register (&edev->dev);
230+
if (rc)
231+
return rc;
231232

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;
235239

236240
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;
237249
}
238250

239251
static int __init eisa_request_resources (struct eisa_root_device *root,

0 commit comments

Comments
 (0)