Skip to content

Commit

Permalink
misc: bcm-vk: fix set_q_num API precedence issue
Browse files Browse the repository at this point in the history
Change set_q_num API to use if-else to make it more explicit,
and avoid a precedence rule issue.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Desmond Yan <desmond.yan@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Link: https://lore.kernel.org/r/20210129060403.14801-1-scott.branden@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Desmond Yan authored and Greg Kroah-Hartman committed Jan 29, 2021
1 parent e4612ec commit d71277d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/misc/bcm-vk/bcm_vk_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ static u32 get_q_num(const struct vk_msg_blk *msg)

static void set_q_num(struct vk_msg_blk *msg, u32 q_num)
{
msg->trans_id = (msg->trans_id & ~BCM_VK_MSG_Q_MASK) |
(q_num >= VK_MSGQ_PER_CHAN_MAX) ? VK_MSGQ_NUM_DEFAULT : q_num;
u32 trans_q;

if (q_num >= VK_MSGQ_PER_CHAN_MAX)
trans_q = VK_MSGQ_NUM_DEFAULT;
else
trans_q = q_num;

msg->trans_id = (msg->trans_id & ~BCM_VK_MSG_Q_MASK) | trans_q;
}

static u32 get_msg_id(const struct vk_msg_blk *msg)
Expand Down

0 comments on commit d71277d

Please sign in to comment.