Skip to content

Commit

Permalink
eth: linkdata: sxevf: Fix wrong logic in 'sxevf_mailbox_lock'
Browse files Browse the repository at this point in the history
SXE_VFMAILBOX_VFU is just a bitmask. We need to perform a bitwise
AND operation between this bitmask and the returned register value
to determine if the specific flags are set successfully.

Fix follow error with clang-19:

drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^  ~~~~~~~~~~~~~~~~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: note: use '&' for a bitwise operation
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^~
      |                                            &
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: note: remove constant to silence this warning
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: WangYuli <[email protected]>
  • Loading branch information
Avenger-285714 committed Nov 25, 2024
1 parent 4dc5b54 commit fc69c45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ STATIC s32 sxevf_mailbox_lock(struct sxevf_hw *hw)
mailbox |= SXE_VFMAILBOX_VFU;
hw->mbx.ops->mailbox_write(hw, mailbox);

if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
if (sxevf_mbx_reg_read(hw) & SXE_VFMAILBOX_VFU) {
ret = 0;
break;
}
Expand Down

0 comments on commit fc69c45

Please sign in to comment.