s390/diag: Return errno's from diag204

Return different errno's from diag204 to allow users to handle them
accordingly. Instead of returning -1 regardless of the failing
condition, return -EINVAL on invalid memory address and -EOPNOTSUPP when
diag instruction fails.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Mete Durlu 2024-07-04 14:10:05 +02:00 committed by Vasily Gorbik
parent 7455a33179
commit bb9be93acb

View File

@ -215,16 +215,16 @@ int diag204(unsigned long subcode, unsigned long size, void *addr)
{
if (addr) {
if (WARN_ON_ONCE(!is_vmalloc_addr(addr)))
return -1;
return -EINVAL;
if (WARN_ON_ONCE(!IS_ALIGNED((unsigned long)addr, PAGE_SIZE)))
return -1;
return -EINVAL;
}
if ((subcode & DIAG204_SUBCODE_MASK) == DIAG204_SUBC_STIB4)
addr = (void *)pfn_to_phys(vmalloc_to_pfn(addr));
diag_stat_inc(DIAG_STAT_X204);
size = __diag204(&subcode, size, addr);
if (subcode)
return -1;
return -EOPNOTSUPP;
return size;
}
EXPORT_SYMBOL(diag204);