diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2009-03-26 17:24:14 +0300 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-03-26 17:24:15 +0300 |
commit | 50f1548399b7bd00ceb38c84a84463a89c82afe8 (patch) | |
tree | c1d334bb49b1fc9cbeef9761dea1eb8ec979e4f8 /drivers/s390/cio/ccwgroup.c | |
parent | 40c9f9992bc1caa1bb890bd8163361dbf2eefa86 (diff) | |
download | linux-50f1548399b7bd00ceb38c84a84463a89c82afe8.tar.xz |
[S390] cio: fix sanity checks in ccwgroup driver.
Some sanity checks in the ccw group driver test the output of
container_of macros to be !NULL. Test the input parameters instead.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/ccwgroup.c')
-rw-r--r-- | drivers/s390/cio/ccwgroup.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index ec2742813bf2..2becedbe8883 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -454,13 +454,17 @@ ccwgroup_remove (struct device *dev) struct ccwgroup_device *gdev; struct ccwgroup_driver *gdrv; + device_remove_file(dev, &dev_attr_online); + + if (!dev->driver) + return 0; + gdev = to_ccwgroupdev(dev); gdrv = to_ccwgroupdrv(dev->driver); - device_remove_file(dev, &dev_attr_online); - - if (gdrv && gdrv->remove) + if (gdrv->remove) gdrv->remove(gdev); + return 0; } @@ -469,9 +473,13 @@ static void ccwgroup_shutdown(struct device *dev) struct ccwgroup_device *gdev; struct ccwgroup_driver *gdrv; + if (!dev->driver) + return; + gdev = to_ccwgroupdev(dev); gdrv = to_ccwgroupdrv(dev->driver); - if (gdrv && gdrv->shutdown) + + if (gdrv->shutdown) gdrv->shutdown(gdev); } |