linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Dept-GELinuxNICDev@cavium.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Clang warning in drivers/net/ethernet/qlogic/qla3xxx.c
Date: Thu, 4 Oct 2018 00:05:58 -0700	[thread overview]
Message-ID: <20181004070558.GA6535@flashbox> (raw)

Hi all,

In an effort to get the kernel compiling warning free with Clang, I came
the following warning:

drivers/net/ethernet/qlogic/qla3xxx.c:384:24: warning: signed shift result (0xF00000000) requires 37 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
                           ((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data));
                             ~~~~~~~~~~~~~~ ^  ~~
1 warning generated.

This particular statement has been present since the introduction of the
driver in 2006 so I am unsure if this was intention or if maybe the
statement should have been removed since ISP_NVRAM_MASK is defined as
'0x000F << 16' in drivers/net/ethernet/qlogic/qla3xxx.h and it's the
only enum to be shifted. This is the only location in the driver that
has this warning.

Perhaps this diff would solve the warning and keep the driver
functional? I'll be happy to send a formal patch if that is the case.



diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index b48f76182049..10b075bc5959 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -380,8 +380,6 @@ static void fm93c56a_select(struct ql3_adapter *qdev)
 
        qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1;
        ql_write_nvram_reg(qdev, spir, ISP_NVRAM_MASK | qdev->eeprom_cmd_data);
-       ql_write_nvram_reg(qdev, spir,
-                          ((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data));
 }
 
 /*

                 reply	other threads:[~2018-10-04  7:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181004070558.GA6535@flashbox \
    --to=natechancellor@gmail.com \
    --cc=Dept-GELinuxNICDev@cavium.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).