Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v2 01/11] e100: handle eeprom as little endian
Date: Thu, 25 Mar 2021 17:38:24 -0700	[thread overview]
Message-ID: <20210326003834.3886241-2-jesse.brandeburg@intel.com> (raw)
In-Reply-To: <20210326003834.3886241-1-jesse.brandeburg@intel.com>

Sparse tool was warning on some implicit conversions from
little endian data read from the EEPROM on the e100 cards.

Fix these by being explicit about the conversions using
le16_to_cpu().

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
Warning Detail:
  CHECK   .../intel/e100.c
.../intel/e100.c:1398:32: warning: restricted __le16 degrades to integer
.../intel/e100.c:1518:29: warning: restricted __le16 degrades to integer
.../intel/e100.c:2272:24: warning: restricted __le16 degrades to integer
.../intel/e100.c:2273:25: warning: restricted __le16 degrades to integer
.../intel/e100.c:2274:25: warning: restricted __le16 degrades to integer
.../intel/e100.c:2929:24: warning: restricted __le16 degrades to integer
---
 drivers/net/ethernet/intel/e100.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index f8d78af76d7d..1b0958bd24f6 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1395,7 +1395,7 @@ static int e100_phy_check_without_mii(struct nic *nic)
 	u8 phy_type;
 	int without_mii;
 
-	phy_type = (nic->eeprom[eeprom_phy_iface] >> 8) & 0x0f;
+	phy_type = (le16_to_cpu(nic->eeprom[eeprom_phy_iface]) >> 8) & 0x0f;
 
 	switch (phy_type) {
 	case NoSuchPhy: /* Non-MII PHY; UNTESTED! */
@@ -1515,7 +1515,7 @@ static int e100_phy_init(struct nic *nic)
 		mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr);
 	} else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) &&
 	   (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) &&
-		(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) {
+	   (le16_to_cpu(nic->eeprom[eeprom_cnfg_mdix]) & eeprom_mdix_enabled))) {
 		/* enable/disable MDI/MDI-X auto-switching. */
 		mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG,
 				nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH);
@@ -2269,9 +2269,9 @@ static int e100_asf(struct nic *nic)
 {
 	/* ASF can be enabled from eeprom */
 	return (nic->pdev->device >= 0x1050) && (nic->pdev->device <= 0x1057) &&
-	   (nic->eeprom[eeprom_config_asf] & eeprom_asf) &&
-	   !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) &&
-	   ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE);
+	   (le16_to_cpu(nic->eeprom[eeprom_config_asf]) & eeprom_asf) &&
+	   !(le16_to_cpu(nic->eeprom[eeprom_config_asf]) & eeprom_gcl) &&
+	   ((le16_to_cpu(nic->eeprom[eeprom_smbus_addr]) & 0xFF) != 0xFE);
 }
 
 static int e100_up(struct nic *nic)
@@ -2926,7 +2926,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	/* Wol magic packet can be enabled from eeprom */
 	if ((nic->mac >= mac_82558_D101_A4) &&
-	   (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
+	   (le16_to_cpu(nic->eeprom[eeprom_id]) & eeprom_id_wol)) {
 		nic->flags |= wol_magic;
 		device_set_wakeup_enable(&pdev->dev, true);
 	}

base-commit: 4390eafe5ee738a90ab2ae0e3eb2c81330107d05
-- 
2.30.2


  reply	other threads:[~2021-03-26  0:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  0:38 [Intel-wired-lan] [PATCH net-next v2 00/11] warning cleanups Jesse Brandeburg
2021-03-26  0:38 ` Jesse Brandeburg [this message]
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 02/11] intel: remove checker warning Jesse Brandeburg
2021-04-22 22:53   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 03/11] fm10k: move error check Jesse Brandeburg
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 04/11] igb/igc: use strongly typed pointer Jesse Brandeburg
2021-04-11  7:09   ` Dvora Fuxbrumer
2021-04-22 22:06   ` Switzer, David
2021-04-22 23:11   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 05/11] igb: handle vlan types with checker enabled Jesse Brandeburg
2021-04-22 22:08   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 06/11] igb: fix assignment on big endian machines Jesse Brandeburg
2021-04-22 22:10   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 07/11] igb: override two checker warnings Jesse Brandeburg
2021-04-22 22:09   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 08/11] intel: call csum functions with well formatted arguments Jesse Brandeburg
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 09/11] igbvf: convert to strongly typed descriptors Jesse Brandeburg
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 10/11] ixgbe: use checker safe conversions Jesse Brandeburg
2021-04-23 22:38   ` Switzer, David
2021-03-26  0:38 ` [Intel-wired-lan] [PATCH net-next v2 11/11] ixgbe: reduce checker warnings Jesse Brandeburg
2021-03-26  1:32   ` Shannon Nelson
2021-04-23 22:39   ` Switzer, David

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=20210326003834.3886241-2-jesse.brandeburg@intel.com \
    --to=jesse.brandeburg@intel.com \
    --cc=intel-wired-lan@osuosl.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