Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/mpi: Fix unused variable warnings

This patch removes a number of unused variables and marks others
as unused in order to silence compiler warnings about them.

Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+3 -10
-4
lib/mpi/mpi-div.c
··· 92 92 unsigned int normalization_steps; 93 93 mpi_limb_t q_limb; 94 94 mpi_ptr_t marker[5]; 95 - unsigned int marker_nlimbs[5]; 96 95 int markidx = 0; 97 96 98 97 /* Ensure space is enough for quotient and remainder. ··· 151 152 * numerator would be gradually overwritten by the quotient limbs. 152 153 */ 153 154 if (qp == np) { /* Copy NP object to temporary space. */ 154 - marker_nlimbs[markidx] = nsize; 155 155 np = marker[markidx++] = mpi_alloc_limb_space(nsize); 156 156 MPN_COPY(np, qp, nsize); 157 157 } ··· 171 173 * the most significant word. Use temporary storage not to clobber 172 174 * the original contents of the denominator. 173 175 */ 174 - marker_nlimbs[markidx] = dsize; 175 176 tp = marker[markidx++] = mpi_alloc_limb_space(dsize); 176 177 mpihelp_lshift(tp, dp, dsize, normalization_steps); 177 178 dp = tp; ··· 192 195 if (dp == rp || (quot && (dp == qp))) { 193 196 mpi_ptr_t tp; 194 197 195 - marker_nlimbs[markidx] = dsize; 196 198 tp = marker[markidx++] = mpi_alloc_limb_space(dsize); 197 199 MPN_COPY(tp, dp, dsize); 198 200 dp = tp;
+1 -1
lib/mpi/mpi-internal.h
··· 114 114 */ 115 115 #define UDIV_QRNND_PREINV(q, r, nh, nl, d, di) \ 116 116 do { \ 117 - mpi_limb_t _ql; \ 117 + mpi_limb_t _ql __maybe_unused; \ 118 118 mpi_limb_t _q, _r; \ 119 119 mpi_limb_t _xh, _xl; \ 120 120 umul_ppmm(_q, _ql, (nh), (di)); \
-3
lib/mpi/mpi-mul.c
··· 21 21 int usign, vsign, sign_product; 22 22 int assign_wp = 0; 23 23 mpi_ptr_t tmp_limb = NULL; 24 - unsigned int tmp_limb_nlimbs = 0; 25 24 26 25 if (u->nlimbs < v->nlimbs) { 27 26 /* Swap U and V. */ ··· 54 55 } else { /* Make U and V not overlap with W. */ 55 56 if (wp == up) { 56 57 /* W and U are identical. Allocate temporary space for U. */ 57 - tmp_limb_nlimbs = usize; 58 58 up = tmp_limb = mpi_alloc_limb_space(usize); 59 59 /* Is V identical too? Keep it identical with U. */ 60 60 if (wp == vp) ··· 62 64 MPN_COPY(up, wp, usize); 63 65 } else if (wp == vp) { 64 66 /* W and V are identical. Allocate temporary space for V. */ 65 - tmp_limb_nlimbs = vsize; 66 67 vp = tmp_limb = mpi_alloc_limb_space(vsize); 67 68 /* Copy to the temporary space. */ 68 69 MPN_COPY(vp, wp, vsize);
+2 -2
lib/mpi/mpih-div.c
··· 31 31 { 32 32 mpi_size_t i; 33 33 mpi_limb_t n1, n0, r; 34 - mpi_limb_t dummy; 34 + mpi_limb_t dummy __maybe_unused; 35 35 36 36 /* Botch: Should this be handled at all? Rely on callers? */ 37 37 if (!dividend_size) ··· 382 382 { 383 383 mpi_size_t i; 384 384 mpi_limb_t n1, n0, r; 385 - mpi_limb_t dummy; 385 + mpi_limb_t dummy __maybe_unused; 386 386 387 387 if (!dividend_size) 388 388 return 0;