hw/net/can/ctucan: Avoid unused value in ctucan_send_ready_buffers()
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 10 Nov 2020 21:52:48 +0000 (22:52 +0100)
committerJason Wang <jasowang@redhat.com>
Wed, 11 Nov 2020 12:34:36 +0000 (20:34 +0800)
commite0784d8375962da584fa92be8457845f433e2ae2
tree60eb848e54901c6f834313bacfa337aba80f9992
parent5e73953a276106f8e2be475cca3299748bfd1201
hw/net/can/ctucan: Avoid unused value in ctucan_send_ready_buffers()

Coverity points out that in ctucan_send_ready_buffers() we
set buff_st_mask = 0xf << (i * 4) inside the loop, but then
we never use it before overwriting it later.

The only thing we use the mask for is as part of the code that is
inserting the new buff_st field into tx_status.  That is more
comprehensibly written using deposit32(), so do that and drop the
mask variable entirely.

We also update the buff_st local variable at multiple points
during this function, but nothing can ever see these
intermediate values, so just drop those, write the final
TXT_TOK as a fixed constant value, and collapse the only
remaining set/use of buff_st down into an extract32().

Fixes: Coverity CID 1432869
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Tested-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/can/ctucan_core.c