Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp638112pxv; Thu, 15 Jul 2021 12:09:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNVZc1vYf5cHxKg2UFfM0Pnh4c0bH22OFMI1XfEejq8RaD8j/qyOJqwSei+cYq3yOnZwAh X-Received: by 2002:a50:d642:: with SMTP id c2mr9077490edj.22.1626376160663; Thu, 15 Jul 2021 12:09:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376160; cv=none; d=google.com; s=arc-20160816; b=oBpHouZkZysAZ0pXzRAMujmz6oHMVX4jwKIE99GRqYRPZMrfOc/lmMfbyGMsYQIGE2 IjEuK3u9gRqKLMvCGhUPTLtfDMbcJKXo+t2TbgMFducldfKLwJ/ogWaE7X+Ly/+blbar xhu0laznPNUHET3d4NVB/50yDLrlcowgpoLR7tZR/APN79Y4+T/tOwihaJL80k6eciop ixJ63phZgrjbjyqPksP9GT4OUBavYwy+5Npvn3cva6LiAozKVgO7e8zeLIGcOHIZlp8t DFrW43Icl8ayYUweIQ9ZXmU5/3Mun4Cg0XiBELgh+2AwAkhm6BMz2hXrPx2AIpAgXgjG iU8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k60a6O67uAgaAF4s1NpEIHLBBDxW3ovUAmicYeNlmgA=; b=g4KkUvcaylOsuw32NxCySxIYmoCVmjqdEcBnWWjuG5P7ulFJOVk3LYMQ6dQkeintvb 95MEuStsYRA6XO6AngFUfr0A3ROAQLjbnFV07JUhz2VeB2iqJ4qjxtPRLp/B9cQnyxAE t5vCK9/1FUaED9UI5rPC+NRAE6s9c2rz0ejPvoL+qrjmKAvo8E4UXCDw2ELd7Kxipif9 tTuzF8OjEtMugvGkSynCCu2Lj5ccjpVbJeGz6ewSJvN/S3+Pjflc4fIYZNdvMO/1THgi sPWbtkjk8Jk9msGffsG3MNjNuXtAMNGJGScNuGFr1lWNdQresGaKF1n+2tS3VPRNsR4B XDmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MgVQcZlD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zm10si8230413ejb.633.2021.07.15.12.08.57; Thu, 15 Jul 2021 12:09:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MgVQcZlD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243016AbhGOTJW (ORCPT + 99 others); Thu, 15 Jul 2021 15:09:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:60992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241997AbhGOS6F (ORCPT ); Thu, 15 Jul 2021 14:58:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C86A613E0; Thu, 15 Jul 2021 18:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375303; bh=SJnchJOCWq86jSivAcKUt8nRUW+Uh1jnOWnGDw2p6Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MgVQcZlDA5QBa/VIuP/C2GCNMArMQm4gJJiQ6IDA+CRVyojRMtU9dwZHtIk/qF7ck 518lBszxCC7++ab/4i97IBHHIlSP6Gue6CqtARPUsB/OHWfJVnAkBjgmMCw6iSJV58 pPJepWXdN8hf9YEZLLOWYW1CIMTTs123XOn2Zrs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , Sasha Levin Subject: [PATCH 5.12 031/242] e100: handle eeprom as little endian Date: Thu, 15 Jul 2021 20:36:33 +0200 Message-Id: <20210715182557.391036071@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg [ 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 Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- 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