From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Chancellor Subject: Clang warning in drivers/net/ethernet/qlogic/qla3xxx.c Date: Thu, 4 Oct 2018 00:05:58 -0700 Message-ID: <20181004070558.GA6535@flashbox> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Dept-GELinuxNICDev@cavium.com Return-path: Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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)); } /*