]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/diag: Return errno's from diag204
authorMete Durlu <meted@linux.ibm.com>
Thu, 4 Jul 2024 12:10:05 +0000 (14:10 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 10 Jul 2024 17:50:44 +0000 (19:50 +0200)
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>
arch/s390/kernel/diag.c

index 8dee9aa0ec95b463397addfc0df299dad58730f0..9f33dcecbffab5046b8f15c0e1d5abb85db3ceb3 100644 (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);