s390: proper type casts for csum_partial invocations
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 20 Dec 2016 15:08:05 +0000 (16:08 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jan 2017 06:27:53 +0000 (07:27 +0100)
Keep sparse and other static code checkers from emitting warnings like:

arch/s390/kernel/ipl.c:1549:14: warning: incorrect type in assignment (different base types)
arch/s390/kernel/ipl.c:1549:14:    expected unsigned int [unsigned] csum
arch/s390/kernel/ipl.c:1549:14:    got restricted __wsum

All usages in s390 code are ok. Therefore add proper casts.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/ipl.c
arch/s390/kernel/os_info.c
drivers/s390/char/zcore.c

index ff3364a067ff73f42678cb95ae28023472e48b85..2c6ddced53946bd0320e2ffd71bc39e2b66254d2 100644 (file)
@@ -1546,7 +1546,8 @@ static void dump_reipl_run(struct shutdown_trigger *trigger)
        unsigned long ipib = (unsigned long) reipl_block_actual;
        unsigned int csum;
 
-       csum = csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0);
+       csum = (__force unsigned int)
+              csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0);
        mem_assign_absolute(S390_lowcore.ipib, ipib);
        mem_assign_absolute(S390_lowcore.ipib_checksum, csum);
        dump_run(trigger);
index 87f05e475ae86da9427bd13e73dc56a9e21a04b5..753ba63182b966eced22c3723e7c263077ed72ed 100644 (file)
@@ -26,7 +26,7 @@ static struct os_info os_info __page_aligned_data;
 u32 os_info_csum(struct os_info *os_info)
 {
        int size = sizeof(*os_info) - offsetof(struct os_info, version_major);
-       return csum_partial(&os_info->version_major, size, 0);
+       return (__force u32)csum_partial(&os_info->version_major, size, 0);
 }
 
 /*
@@ -46,7 +46,7 @@ void os_info_entry_add(int nr, void *ptr, u64 size)
 {
        os_info.entry[nr].addr = (u64)(unsigned long)ptr;
        os_info.entry[nr].size = size;
-       os_info.entry[nr].csum = csum_partial(ptr, size, 0);
+       os_info.entry[nr].csum = (__force u32)csum_partial(ptr, size, 0);
        os_info.csum = os_info_csum(&os_info);
 }
 
@@ -93,7 +93,7 @@ static void os_info_old_alloc(int nr, int align)
                msg = "copy failed";
                goto fail_free;
        }
-       csum = csum_partial(buf_align, size, 0);
+       csum = (__force u32)csum_partial(buf_align, size, 0);
        if (csum != os_info_old->entry[nr].csum) {
                msg = "checksum failed";
                goto fail_free;
index 863211a0b312e2c00196c76a96fe80f39a89bde8..aaed778f67c4ab84bf13dc9435260a5bdae361dc 100644 (file)
@@ -272,7 +272,7 @@ static int __init zcore_reipl_init(void)
                rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE);
        else
                rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE);
-       if (rc || csum_partial(ipl_block, ipl_block->hdr.len, 0) !=
+       if (rc || (__force u32)csum_partial(ipl_block, ipl_block->hdr.len, 0) !=
            ipib_info.checksum) {
                TRACE("Checksum does not match\n");
                free_page((unsigned long) ipl_block);