summaryrefslogtreecommitdiff
path: root/drivers/s390/char/sclp_early.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2014-02-24 14:30:00 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-02-24 17:13:57 +0100
commit9499934f70deac0cdb96aa2d90f2a0a2de69d80c (patch)
tree99c6c2ed6f42c4f463a2c97d985c859c3803207e /drivers/s390/char/sclp_early.c
parent322986ca64d170abb343763640763f3d7933bb69 (diff)
s390/sclp_early: Return correct HSA block count also for zero
Currently we return a negative block count if SCLP returns HSA block count zero. The reason is that we subtract one for the header page. So fix this and correctly return zero block count if SCLP returns zero. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char/sclp_early.c')
-rw-r--r--drivers/s390/char/sclp_early.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c
index 82f2c389b4d1..2c6aac66e2b0 100644
--- a/drivers/s390/char/sclp_early.c
+++ b/drivers/s390/char/sclp_early.c
@@ -184,9 +184,9 @@ static long __init sclp_hsa_size_init(struct sdias_sccb *sccb)
sccb_init_eq_size(sccb);
if (sclp_cmd_early(SCLP_CMDW_WRITE_EVENT_DATA, sccb))
return -EIO;
- if (sccb->evbuf.blk_cnt != 0)
- return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE;
- return 0;
+ if (sccb->evbuf.blk_cnt == 0)
+ return 0;
+ return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE;
}
static long __init sclp_hsa_copy_wait(struct sccb_header *sccb)
@@ -195,6 +195,8 @@ static long __init sclp_hsa_copy_wait(struct sccb_header *sccb)
sccb->length = PAGE_SIZE;
if (sclp_cmd_early(SCLP_CMDW_READ_EVENT_DATA, sccb))
return -EIO;
+ if (((struct sdias_sccb *) sccb)->evbuf.blk_cnt == 0)
+ return 0;
return (((struct sdias_sccb *) sccb)->evbuf.blk_cnt - 1) * PAGE_SIZE;
}