netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.13 045/189] e100: handle eeprom as little endian
Date: Tue,  6 Jul 2021 07:11:45 -0400	[thread overview]
Message-ID: <20210706111409.2058071-45-sashal@kernel.org> (raw)
In-Reply-To: <20210706111409.2058071-1-sashal@kernel.org>

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

[ Upstream commit d4ef55288aa2e1b76033717242728ac98ddc4721 ]

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>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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);
 	}
-- 
2.30.2


  parent reply	other threads:[~2021-07-06 11:23 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210706111409.2058071-1-sashal@kernel.org>
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 013/189] net: pch_gbe: Use proper accessors to BE data in pch_ptp_match() Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 021/189] atm: iphase: fix possible use-after-free in ia_module_exit() Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 022/189] mISDN: fix possible use-after-free in HFC_cleanup() Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 023/189] atm: nicstar: Fix possible use-after-free in nicstar_cleanup() Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 024/189] net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 027/189] net: mdio: ipq8064: add regmap config to disable REGCACHE Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 032/189] bpf: Check for BPF_F_ADJ_ROOM_FIXED_GSO when bpf_skb_change_proto Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 033/189] net: mdio: provide shim implementation of devm_of_mdiobus_register Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 034/189] net/sched: cls_api: increase max_reclassify_loop Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 035/189] net: ethernet: ixp4xx: Fix return value check in ixp4xx_eth_probe() Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 041/189] net: xilinx_emaclite: Do not print real IOMEM pointer Sasha Levin
2021-07-06 11:11 ` Sasha Levin [this message]
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 046/189] igb: handle vlan types with checker enabled Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 047/189] igb: fix assignment on big endian machines Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 052/189] net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 053/189] net/mlx5: Fix lag port remapping logic Sasha Levin
2021-07-06 11:11 ` [PATCH AUTOSEL 5.13 056/189] net: stmmac: the XPCS obscures a potential "PHY not found" error Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 062/189] virtio-net: Add validation for used length Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 063/189] ipv6: use prandom_u32() for ID generation Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 071/189] net: tcp better handling of reordering then loss cases Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 072/189] icmp: fix lib conflict with trinity Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 078/189] net: bridge: mrp: Update ring transitions Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 080/189] ice: set the value of global config lock timeout longer Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 081/189] ice: fix clang warning regarding deadcode.DeadStores Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 082/189] virtio_net: Remove BUG() to avoid machine dead Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 083/189] net: mscc: ocelot: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 084/189] net: bcmgenet: " Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 085/189] net: mvpp2: " Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 086/189] net: micrel: " Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 087/189] net: moxa: Use devm_platform_get_and_ioremap_resource() Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 095/189] net: phy: realtek: add delay to fix RXC generation issue Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 096/189] selftests: Clean forgotten resources as part of cleanup() Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 097/189] net: sgi: ioc3-eth: check return value after calling platform_get_resource() Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 099/189] fjes: " Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 100/189] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource() Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 102/189] r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPM Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 104/189] ibmvnic: fix kernel build warnings in build_hdr_descs_arr Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 105/189] xfrm: Fix error reporting in xfrm_state_construct Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 107/189] wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 108/189] net: phy: nxp-c45-tja11xx: enable MDIO write access to the master/slave registers Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 109/189] wl1251: Fix possible buffer overflow in wl1251_cmd_scan Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 110/189] cw1200: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 115/189] net: hsr: don't check sequence number if tag removal is offloaded Sasha Levin
2021-07-06 11:12 ` [PATCH AUTOSEL 5.13 118/189] bpf: Fix up register-based shifts in interpreter to silence KUBSAN Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 120/189] ice: fix incorrect payload indicator on PTYPE Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 121/189] ice: mark PTYPE 2 as reserved Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 122/189] mt76: mt7615: fix fixed-rate tx status reporting Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 123/189] mt76: dma: use ieee80211_tx_status_ext to free packets when tx fails Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 125/189] net: ipa: Add missing of_node_put() in ipa_firmware_load() Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 126/189] net: sched: fix error return code in tcf_del_walker() Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 130/189] mt76: mt7915: fix tssi indication field of DBDC NICs Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 131/189] mt76: mt7921: fix reset under the deep sleep is enabled Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 132/189] mt76: mt7921: reset wfsys during hw probe Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 133/189] mt76: mt7921: enable hw offloading for wep keys Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 134/189] mt76: connac: fix UC entry is being overwritten Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 135/189] mt76: connac: fix the maximum interval schedule scan can support Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 136/189] mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 137/189] mt76: fix iv and CCMP header insertion Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 138/189] rtl8xxxu: Fix device info for RTL8192EU devices Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 141/189] net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 142/189] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 143/189] atm: nicstar: use 'dma_free_coherent' instead of 'kfree' Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 144/189] atm: nicstar: register the interrupt handler in the right place Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 145/189] vsock: notify server to shutdown when client has pending signal Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 149/189] iwlwifi: mvm: don't change band on bound PHY contexts Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 150/189] iwlwifi: mvm: apply RX diversity per PHY context Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 151/189] iwlwifi: mvm: fix error print when session protection ends Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 152/189] iwlwifi: mvm: support LONG_GROUP for WOWLAN_GET_STATUSES version Sasha Levin
2021-07-06 14:09   ` Johannes Berg
2021-07-07 10:46     ` Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 153/189] iwlwifi: pcie: free IML DMA memory allocation Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 154/189] iwlwifi: pcie: fix context info freeing Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 155/189] rtw88: 8822c: update RF parameter tables to v62 Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 156/189] rtw88: add quirks to disable pci capabilities Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 157/189] sfc: avoid double pci_remove of VFs Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 158/189] sfc: error code if SRIOV cannot be disabled Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 159/189] net: dsa: b53: Create default VLAN entry explicitly Sasha Levin
2021-07-06 15:07   ` Florian Fainelli
2021-07-07 10:46     ` Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 160/189] wireless: wext-spy: Fix out-of-bounds warning Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 161/189] cfg80211: fix default HE tx bitrate mask in 2G band Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 162/189] mac80211: consider per-CPU statistics if present Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 163/189] mac80211_hwsim: add concurrent channels scanning support over virtio Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 164/189] mac80211: Properly WARN on HW scan before restart Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 166/189] media, bpf: Do not copy more entries than user space requested Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 167/189] net: retrieve netns cookie via getsocketopt Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 168/189] net: ip: avoid OOM kills with large UDP sends over loopback Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 171/189] Bluetooth: cmtp: fix file refcount when cmtp_attach_device fails Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 172/189] Bluetooth: Fix the HCI to MGMT status conversion table Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 173/189] Bluetooth: Fix alt settings for incoming SCO with transparent coding format Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 174/189] Bluetooth: Shutdown controller after workqueues are flushed or cancelled Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 176/189] Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 177/189] Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Sasha Levin
2021-07-06 11:13 ` [PATCH AUTOSEL 5.13 179/189] Bluetooth: mgmt: Fix the command returns garbage parameter value Sasha Levin
2021-07-06 11:14 ` [PATCH AUTOSEL 5.13 183/189] bpf: Fix false positive kmemleak report in bpf_ringbuf_area_alloc() Sasha Levin
2021-07-06 11:14 ` [PATCH AUTOSEL 5.13 184/189] flow_offload: action should not be NULL when it is referenced Sasha Levin
2021-08-06  9:30   ` Eric Dumazet
2021-08-09 16:06     ` Sasha Levin
2021-07-06 11:14 ` [PATCH AUTOSEL 5.13 185/189] sctp: validate from_addr_param return Sasha Levin
2021-07-06 11:14 ` [PATCH AUTOSEL 5.13 186/189] sctp: add size validation when walking chunks Sasha Levin

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=20210706111409.2058071-45-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@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).