From 15535bf6489c48bc850e28245e149fcf3810251c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 15 Jun 2015 22:06:29 +0000 Subject: [PATCH] iscsi-scst: Suppress a compiler warning Avoid that the compiler complains that the variable 'pad_bytes' is not used with CONFIG_LIBCRC32C=n. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6314 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/digest.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index 1da1a04d0..29f9e645d 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -61,7 +61,6 @@ static __be32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, uint32_t padding) { u32 crc = ~0; - int pad_bytes = ((nbytes + 3) & -4) - nbytes; #ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES if (((scst_random() % 100000) == 752)) { @@ -71,15 +70,19 @@ static __be32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, #endif #if defined(CONFIG_LIBCRC32C_MODULE) || defined(CONFIG_LIBCRC32C) - while (nbytes > 0) { - int d = min(nbytes, (int)(sg->length)); - crc = crc32c(crc, sg_virt(sg), d); - nbytes -= d; - sg++; - } + { + int pad_bytes = ((nbytes + 3) & -4) - nbytes; - if (pad_bytes) - crc = crc32c(crc, (u8 *)&padding, pad_bytes); + while (nbytes > 0) { + int d = min(nbytes, (int)(sg->length)); + crc = crc32c(crc, sg_virt(sg), d); + nbytes -= d; + sg++; + } + + if (pad_bytes) + crc = crc32c(crc, (u8 *)&padding, pad_bytes); + } #endif return (__force __be32)~cpu_to_le32(crc);