Commit 17088229 authored by Cornelia Huck's avatar Cornelia Huck Committed by Martin Schwidefsky

[S390] duplicate ccw devices in ccwgroup.

Fail to create a ccwgroup device if a ccw device is passed in twice.
Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent ba4ba8a6
...@@ -152,7 +152,6 @@ ccwgroup_create(struct device *root, ...@@ -152,7 +152,6 @@ ccwgroup_create(struct device *root,
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
int i; int i;
int rc; int rc;
int del_drvdata;
if (argc > 256) /* disallow dumb users */ if (argc > 256) /* disallow dumb users */
return -EINVAL; return -EINVAL;
...@@ -163,7 +162,6 @@ ccwgroup_create(struct device *root, ...@@ -163,7 +162,6 @@ ccwgroup_create(struct device *root,
atomic_set(&gdev->onoff, 0); atomic_set(&gdev->onoff, 0);
del_drvdata = 0;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
gdev->cdev[i] = get_ccwdev_by_busid(cdrv, argv[i]); gdev->cdev[i] = get_ccwdev_by_busid(cdrv, argv[i]);
...@@ -180,10 +178,8 @@ ccwgroup_create(struct device *root, ...@@ -180,10 +178,8 @@ ccwgroup_create(struct device *root,
rc = -EINVAL; rc = -EINVAL;
goto free_dev; goto free_dev;
} }
}
for (i = 0; i < argc; i++)
gdev->cdev[i]->dev.driver_data = gdev; gdev->cdev[i]->dev.driver_data = gdev;
del_drvdata = 1; }
gdev->creator_id = creator_id; gdev->creator_id = creator_id;
gdev->count = argc; gdev->count = argc;
...@@ -226,9 +222,9 @@ ccwgroup_create(struct device *root, ...@@ -226,9 +222,9 @@ ccwgroup_create(struct device *root,
free_dev: free_dev:
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
if (gdev->cdev[i]) { if (gdev->cdev[i]) {
put_device(&gdev->cdev[i]->dev); if (gdev->cdev[i]->dev.driver_data == gdev)
if (del_drvdata)
gdev->cdev[i]->dev.driver_data = NULL; gdev->cdev[i]->dev.driver_data = NULL;
put_device(&gdev->cdev[i]->dev);
} }
kfree(gdev); kfree(gdev);
return rc; return rc;
......
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