mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
fm10k: reduce the scope of the local msg variable
The msg variable in the fm10k_mbx_validate_msg_size and
fm10k_sm_mbx_transmit functions is only used within the do {} loop
scope. Reduce its scope only to where it is used.
This was detected by cppcheck, and resolves the following warnings
produced by that tool:
[fm10k_mbx.c:299]: (style) The scope of the variable 'msg' can be reduced.
[fm10k_mbx.c:2004]: (style) The scope of the variable 'msg' can be reduced.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
d56b47791d
commit
71974d7e85
|
|
@ -297,13 +297,14 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
|
|||
{
|
||||
struct fm10k_mbx_fifo *fifo = &mbx->rx;
|
||||
u16 total_len = 0, msg_len;
|
||||
u32 *msg;
|
||||
|
||||
/* length should include previous amounts pushed */
|
||||
len += mbx->pushed;
|
||||
|
||||
/* offset in message is based off of current message size */
|
||||
do {
|
||||
u32 *msg;
|
||||
|
||||
msg = fifo->buffer + fm10k_fifo_tail_offset(fifo, total_len);
|
||||
msg_len = FM10K_TLV_DWORD_LEN(*msg);
|
||||
total_len += msg_len;
|
||||
|
|
@ -1920,7 +1921,6 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
|
|||
/* reduce length by 1 to convert to a mask */
|
||||
u16 mbmem_len = mbx->mbmem_len - 1;
|
||||
u16 tail_len, len = 0;
|
||||
u32 *msg;
|
||||
|
||||
/* push head behind tail */
|
||||
if (mbx->tail < head)
|
||||
|
|
@ -1930,6 +1930,8 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
|
|||
|
||||
/* determine msg aligned offset for end of buffer */
|
||||
do {
|
||||
u32 *msg;
|
||||
|
||||
msg = fifo->buffer + fm10k_fifo_head_offset(fifo, len);
|
||||
tail_len = len;
|
||||
len += FM10K_TLV_DWORD_LEN(*msg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user