diff options
author | Stefan Wahren <stefan.wahren@i2se.com> | 2016-10-31 14:39:33 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-07 11:05:47 +0100 |
commit | 9224c15c4342280e14272508e0a79cc7912246a1 (patch) | |
tree | 94cb99dc58bb579726d897872d35a8a950122670 /drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | |
parent | 0ece01c67fc8eb9f2e523a7e1bc1826fbb837c1e (diff) |
staging: vchiq_arm: change order during module probe
The current order during module probe is prone to race conditions:
* debugfs entries, sysfs entries, platform code
So fix this by swapping the steps debugfs entries and platform code.
As a benefit this saves us a clean up step in the error path.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 89fa08148f3e..8fcd9400d968 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2914,16 +2914,15 @@ static int vchiq_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fw); - /* create debugfs entries */ - err = vchiq_debugfs_init(); + err = vchiq_platform_init(pdev, &g_state); if (err != 0) - goto failed_debugfs_init; + goto failed_platform_init; err = alloc_chrdev_region(&vchiq_devid, VCHIQ_MINOR, 1, DEVICE_NAME); if (err != 0) { vchiq_log_error(vchiq_arm_log_level, "Unable to allocate device number"); - goto failed_alloc_chrdev; + goto failed_platform_init; } cdev_init(&vchiq_cdev, &vchiq_fops); vchiq_cdev.owner = THIS_MODULE; @@ -2946,9 +2945,10 @@ static int vchiq_probe(struct platform_device *pdev) if (IS_ERR(ptr_err)) goto failed_device_create; - err = vchiq_platform_init(pdev, &g_state); + /* create debugfs entries */ + err = vchiq_debugfs_init(); if (err != 0) - goto failed_platform_init; + goto failed_debugfs_init; vchiq_log_info(vchiq_arm_log_level, "vchiq: initialised - version %d (min %d), device %d.%d", @@ -2957,7 +2957,7 @@ static int vchiq_probe(struct platform_device *pdev) return 0; -failed_platform_init: +failed_debugfs_init: device_destroy(vchiq_class, vchiq_devid); failed_device_create: class_destroy(vchiq_class); @@ -2966,9 +2966,7 @@ failed_class_create: err = PTR_ERR(ptr_err); failed_cdev_add: unregister_chrdev_region(vchiq_devid, 1); -failed_alloc_chrdev: - vchiq_debugfs_deinit(); -failed_debugfs_init: +failed_platform_init: vchiq_log_warning(vchiq_arm_log_level, "could not load vchiq"); return err; } |