Commit 4000622e authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

staging: unisys: visorbus: Fix up visordriver_probe

Fixup the visordriver_probe function. Rearrange the function to avoid
needing gotos and removed unnecessary wmb().
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c6af7a9c
...@@ -752,36 +752,28 @@ dev_stop_periodic_work(struct visor_device *dev) ...@@ -752,36 +752,28 @@ dev_stop_periodic_work(struct visor_device *dev)
static int static int
visordriver_probe_device(struct device *xdev) visordriver_probe_device(struct device *xdev)
{ {
int rc; int res;
struct visor_driver *drv; struct visor_driver *drv;
struct visor_device *dev; struct visor_device *dev;
drv = to_visor_driver(xdev->driver); drv = to_visor_driver(xdev->driver);
dev = to_visor_device(xdev); dev = to_visor_device(xdev);
if (!drv->probe)
return -ENODEV;
down(&dev->visordriver_callback_lock); down(&dev->visordriver_callback_lock);
dev->being_removed = false; dev->being_removed = false;
/*
* ensure that the dev->being_removed flag is cleared before res = drv->probe(dev);
* we start the probe if (res >= 0) {
*/ /* success: reference kept via unmatched get_device() */
wmb(); get_device(&dev->device);
get_device(&dev->device); fix_vbus_dev_info(dev);
if (!drv->probe) {
up(&dev->visordriver_callback_lock);
rc = -ENODEV;
goto away;
} }
rc = drv->probe(dev);
if (rc < 0)
goto away;
fix_vbus_dev_info(dev);
up(&dev->visordriver_callback_lock); up(&dev->visordriver_callback_lock);
rc = 0; return res;
away:
if (rc != 0)
put_device(&dev->device);
return rc;
} }
/** This is called when device_unregister() is called for each child device /** This is called when device_unregister() is called for each child device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment