summaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/css.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.ibm.com>2018-06-25 11:23:26 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-07-17 07:27:54 +0200
commit05b217f4c5573f34f6799698f7d4162c702132bc (patch)
tree5678caf88c1ae544b4f3f81f4cdc8332d0ba19b5 /drivers/s390/cio/css.c
parent71aa11a40d1a1d80196b55d8dd95be2bc4c1649e (diff)
downloadlinux-stable-05b217f4c5573f34f6799698f7d4162c702132bc.tar.gz
linux-stable-05b217f4c5573f34f6799698f7d4162c702132bc.tar.bz2
linux-stable-05b217f4c5573f34f6799698f7d4162c702132bc.zip
s390/css: validate subchannel prior to allocation
In css_alloc_subchannel we allocate the subchannel and do a validation of the subchannel (to decide if we should look for devices via this subchannel). On a typical LPAR we find lots of subchannels to be invalid (because there is no device attached or the device is blacklisted) leading to lots of useless kmalloc and kfree calls. This patch changes the order to only allocate the subchannels that have been found valid. Signed-off-by: Sebastian Ott <sebott@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r--drivers/s390/cio/css.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index e608e8cad88e..e4d6537cdd87 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -171,15 +171,20 @@ static void css_subchannel_release(struct device *dev)
struct subchannel *css_alloc_subchannel(struct subchannel_id schid)
{
struct subchannel *sch;
+ struct schib schib;
int ret;
+ ret = cio_validate_subchannel(schid, &schib);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA);
if (!sch)
return ERR_PTR(-ENOMEM);
- ret = cio_validate_subchannel(sch, schid);
- if (ret < 0)
- goto err;
+ sch->schid = schid;
+ sch->schib = schib;
+ sch->st = schib.pmcw.st;
ret = css_sch_create_locks(sch);
if (ret)