There are two ways for a ccwgroup device to be unregistered:
Via the ungroup attribute, or when on of the slave devices is killed
by a machine check. As we have to unregister the ccwgroup device
via a callback, we'll now have to check whether it hasn't been
already unregistered because of a machine check.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
mutex_lock(&gdev->reg_mutex);
- __ccwgroup_remove_symlinks(gdev);
- device_unregister(dev);
+ if (device_is_registered(&gdev->dev)) {
+ __ccwgroup_remove_symlinks(gdev);
+ device_unregister(dev);
+ }
mutex_unlock(&gdev->reg_mutex);
}