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

9p: virtio: skip incrementing unused variable

Fix the following scan-build warning:
net/9p/trans_virtio.c:504:3: warning: Value stored to 'in' is never read [deadcode.DeadStores]
in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm honestly not 100% sure about this one; I'm tempted to think we
could (should?) just check the return value of pack_sg_list_p to skip
the in_sgs++ and setting sgs[] if it didn't process anything, but I'm
not sure it should ever happen so this is probably fine as is.

Just removing the assignment at least makes it clear the return value
isn't used, so it's an improvement in terms of readability.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>

authored by

Dominique Martinet and committed by
Eric Van Hensbergen
f41b402d 4a73edab

+2 -2
+2 -2
net/9p/trans_virtio.c
··· 501 501 502 502 if (in_pages) { 503 503 sgs[out_sgs + in_sgs++] = chan->sg + out + in; 504 - in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, 505 - in_pages, in_nr_pages, offs, inlen); 504 + pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, 505 + in_pages, in_nr_pages, offs, inlen); 506 506 } 507 507 508 508 BUG_ON(out_sgs + in_sgs > ARRAY_SIZE(sgs));